Welcome to Crystal Reports Development

Welcome! This section introduces you to developing with Crystal Reports, the world standard for desktop and web reporting, and provides you with an overview of the contents of this online help.

Click the appropriate link to jump to that section:

 	About Crystal Reports

 	About the online help

 	Command, button, and key conventions

Additional Resources

Seagate Software offers training for Crystal Reports and other Seagate Software products in major cities throughout North America and the world.

To view schedules and course descriptions or to schedule public or on-site training, visit our web site at:

http://www.seagatesoftware.com/coursedescriptions

Email us at training@seagatesoftware.com or call us at 1-800-877-2340 or 604-681-3435.

Seagate Software Support web site

The Seagate Software Support web site, which serves as an extension of all Seagate Software products, is the place to go for product support, samples, educational documents, tutorials, tools, forums and more:

http://support.seagatesoftware.com

Seagate Software Developers Zone

The Seagate Software Developers zone is the key place for the latest development news. Updated weekly you will find this an invaluable resource on the latest features, issues, and tips and tricks.

http://www.seagatesoftware.com/products/dev_zone

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


About Crystal Reports

Crystal Reports is designed to work with your database to help you analyze and interpret important information. Crystal Reports makes it easy to create simple reports, and, it also has the comprehensive tools you need to produce complex or specialized reports.

Create any report you can imagine

Crystal Reports is designed to produce the report you want from virtually any data source. Built-in report experts guide you step by step through building reports and completing common reporting tasks. Formulas, cross-tabs, subreports, and conditional formatting help make sense of data and uncover important relationships that might otherwise be hidden. Geographic maps and graphs communicate information visually when words and numbers are simply not enough.

Extend reporting to the Web

The flexibility of Crystal Reports doesn't end with creating reports — your reports can be published in a variety of formats including Microsoft® Word and Excel, E-mail and even over the Web. Advanced Web reporting lets other members of your workgroup view and update shared reports inside their web browser.

Incorporate reports into applications

Application and web developers can save time and meet their users needs by integrating the report processing power of Crystal Reports into their database applications. Support for most popular development languages makes it easy to add reporting to any application.

Whether it’s the web master in IT, the promotion manager in marketing, the database administrator in finance or the CEO, Crystal Reports is a powerful tool designed to help everyone analyze and interpret the information that's important to them.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


About the online help

The online help includes technical information on the development tools included with Crystal Reports that allow you to integrate reporting into your application. The guide covers the Report Designer Component. It also contains tutorials and samples that will further aid you with adding the power of Crystal Reports to your application.

Click the appropriate link to jump to that section:

 	Section Contents

 	Using the online help

 	Command, button, and key conventions.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Section Contents

The following is a short description of each section in the online help.

What’s New for Developers

With the release of Crystal Reports version 8.5 developers edition, Crystal Reports continues to improve the flexibility and power of the Report Designer Component, along with it’s web reporting capabilities. New components and features allow you to enhance your users reporting experience and increase the availability of Crystal Reports.

This section introduces the new features and enhancements, which fall into three key coteries:

 	Report Designer Component (RDC)

 	Crystal Report Viewer Control

 	Web Reporting.

Key Features of Crystal Reports 8.x

This section highlights the key changes made for developers in versions 8, and it points you to further information. For a more complete discussion of some of the more major changes, see A Closer Look at Some of the New Features.

Integration Methods

This section is to gives you an understanding of how integrating Crystal Reports into your applications has evolved. You will also learn the benefits of using the latest technology—represented in the Report Design Component (RDC). This technology will enable you to take full advantage of the powerful Crystal Report Print Engine and create the best applications available today.

Migrating to the RDC from the OCX

This section is to illustrates the benefits of using the RDC for integrating reporting functionality into your Visual Basic applications. Learn how to migrate applications from the OCX to the RDC to take advantage of the latest features within Crystal Reports. Also included is an overview of the RDC, its major components, object model, and a description of its advanced features not available within the OCX.

Introducing the Report Designer Component

This section introduces the Report Designer Component (RDC) and explains it’s architecture along with some possible development scenarios. It also provides additional sources for help and information on the RDC, including sample applications that present the RDC in real-world scenarios.

Quick Start for using the RDC

This section helps you get started using the Report Designer Component (RDC) in Microsoft Visual Basic. Three examples provide you with the basic skills needed to use the RDC. You will find a high-level explanation of the steps required to add the RDC to a project, a tutorial on adding an existing report to the RDC, and a tutorial on creating and modifying a new report.

RDC Data Access

This section explains data access through the Report Designer Component (RDC), and describes how to connect to a data source through the Data Explorer. It also provides information on Active Data, the Microsoft Data Environment, and the database drivers used by the RDC.

Understanding the RDC Object Model

This section provides you with an understanding of the Report Designer Component (RDC) Object Model through a high-level overview of how a report is created. The overview is then related to the primary objects and collections contained in the RDC Object Model. More detailed information on a number of the objects, collections, and events is available at the end of the section.

RDC Programming

This section provides solutions to a number of common runtime challenges. Most of these challenges involve accessing an object and then changing the properties. The section first discusses special considerations when programming with the Report Designer Component (RDC); it then presents the two general methods to access an object in a report or subreport. The examples assume that you have used one of these methods to locate the object of interest in order to concentrate on the special considerations that you may have with each of the various procedures.

Programming the Crystal Report Viewers

The Crystal Report Viewer is a front-end user interface for viewing reports. In this section you will find detailed information on implementing the ActiveX and Java Bean viewers in your application.

Programming the Embeddable Crystal Reports Designer Control

This section demonstrates how to integrate the Embeddable Crystal Reports Designer Control (Embeddable Designer) into your application. Included are tutorials on creating sample applications in both Microsoft Visual Basic and Microsoft Visual C++. A brief section on creating reports in the designer at runtime is also included.

Working with Visual C++ and Visual InterDev

This section illustrates how the Report Designer Component (RDC) can be integrated using other development languages. Included are examples in Visual C++ and Visual Interdev.

Report Designer Component Object Model

The Report Designer Component is the ultimate development tool for your reporting needs. In this section you will find a detailed description of the Report Designer Component Object Model and its properties, methods and events.

Report Viewer Object Model

The Crystal Report Viewer contains an extensive object model allowing you complete control over how the viewer appears and functions. This section provides detailed information on the properties, methods and events of the Crystal Report Viewer object model for both the ActiveX viewer, and the Java Bean viewer.

Embeddable Crystal Reports Designer Control Object Model

The Embeddable Crystal Reports Designer Control (Embeddable Designer) is a new addition to the Report Designer Component; it enables you to provide a Crystal Reports designer in your application. In this section, you will find a general overview of the control as well as detailed information on its properties and methods.

Active Data

This section provides information on using active data in the Crystal Reports Development environment. Three areas are covered; the active data driver, Crystal Data Object, and Crystal Data Source Type Library. By reading these sections you will learn how to create active data reports, create recordsets, and connect to the data source through the Report Designer Component automation server.

Crystal Data Source Object Models

Crystal Reports provides support for reporting off data when no true data source exists. In this section you will find detailed information, including properties and methods, on Crystal Data Objects and the Crystal Data Source Type Library.

The Crystal Active Data Driver Reference

This section provides information on the functions available in the Active Data Driver (P2smon.dll). These functions simplify the creation of Data Definition Files and allow you to pass a recordset to a report using the Crystal Report Print Engine.

Appendix A: International Office Directory

This appendix provides contact information by region. For technical support information, see the Technical Support Guide.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using the online help

Crystal Reports online help includes all topics within the user’s guide. It also provides additional reference material ranging from specific information on the function of a button to general information on how to create a report formula based on a sample business scenario.

Locate information quickly

Access online help from the Crystal Reports help menu.

Use the Contents tab to view all major sections in the online help and drill down to specific headings within each section, the Index tab to view topics in alphabetical order, and the Search tab to enter a keyword to view all the sections that relate to the keyword.

Sample Reports

Many topics in the Crystal Reports online help include a list of related sample reports. Use these reports to illustrate concepts the topic describes. The sample reports can be adapted to your own needs.

Sample reports are located in the Crystal Reports directory under \Samples\En\Reports.

Product registration

There are several ways you can register your product:

 	Fill out the Product Registration form on the Seagate Software web site at:

http://www.seagatesoftware.com/register

 	Use the Registration Wizard accessible from the Crystal Enterprise program group.

 	Print the Product Registration form and then fax it to the Registration fax number closest to you. Seagate Software will then fax you a registration number that can be entered into the product the next time you use it.

Registration Fax Numbers

USA/Canada +1 (604) 681-5147

United Kingdom +44 (0) 20 8231 0601

Australia +6 2 9955 7682

Germany +49 (0) 69 9509 6182

Hong Kong +852 2893 2727

Singapore +65 777 8786

Registration is required to access online or telephone technical support. In addition, registering the product will ensure that you are kept up-to-date with product advancements.

Technical Support

To find out how to receive technical support services on the product you purchased:

 	Consult the enclosed Technical Support Guide.

 	Go to our support web site at http://support.seagatesoftware.com.

 	Contact your regional office. See the International Office Directory.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Command, button, and key conventions

The online help uses the following conventions:

Commands and buttons

For easy recognition, command names and button names are displayed in bold. For example: New command, Print button, etc.

Key combinations

Keyboard shortcuts appear in the following forms:

 	Delete means the Del key (either the Delete key, or the Del key on your numeric keypad).

 	Enter means the Enter or Return key, depending on which of these keys appears on your keyboard.

 	Ctrl-Key, Shift-Key, and Alt-Key are examples of the notation for two-key combinations. Press the first key in the combination (Control, Shift, or Alt), and, at the same time, press the second key in the combination (designated above as Key). For example: Ctrl-C means to hold the Control key down and then press the letter C on your keyboard (Ctrl-C is the Windows Copy command).

Other conventions

Courier font indicates data that you enter using the computer keyboard. It is also used to show sample code: CRViewer1.ReportSource = CRXReport.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


What’s New for Developers

With the release of Crystal Reports version 8.5 developers edition, Crystal Reports continues to improve the flexibility and power of the Report Designer Component, along with it’s web reporting capabilities. New components and features allow you to enhance your users reporting experience and increase the availability of Crystal Reports.

This section introduces the new features and enhancements, which fall into three key coteries.

 	Report Designer Component (RDC)

 	Crystal Report Viewer Control

 	Web Reporting.

Click the appropriate link to jump to that section:

 	Web Reporting

 	Report Designer Component 8.5 (RDC)

 	Crystal Report Viewer

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Web Reporting

To better meet your web reporting needs, Crystal Reports now integrates fully with Crystal Enterprise, a web-based report management tool that works within your company’s existing web infrastructure.

If you purchased the Professional or Developer edition of Crystal Reports, then you also received the Crystal Enterprise Standard CD. This additional CD is included in the box with Crystal Reports, along with five free concurrent access licenses of Crystal Enterprise Standard.

Click the appropriate link to jump to that section:

 	Increased value of the Crystal Enterprise Web Component Server

 	Complete XML support for the Web

 	Improved interactivity with parameters

 	Customizable DHTML Report Viewer

 	Display web reports independent of server location

 	Extend reporting abilities with additional applications

 	Improved interactivity with parameters

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Increased value of the Crystal Enterprise Web Component Server

Use the newly re-designed and enhanced Web Component Server (WCS) from Crystal Enterprise to power your web-reporting solution and to replace the older WCS from Crystal Reports 8. Crystal Enterprise Standard provides significant improvements and enhancements over the version 8 WCS.

Run the Web Component Server on any machine

Install the Crystal Enterprise Standard CD on whichever machine you want to coordinate your web reports. With Crystal Enterprise Standard, you no longer need to install and run Crystal Reports and the WCS on your web server.

If you need a reporting solution with greater scalability, use Crystal Enterprise Professional, which can be installed on as many machines as are necessary (whereas Crystal Enterprise Standard is limited to installation on a single machine). Further, with Crystal Enterprise Professional, you can specify the server pieces you want running on each machine.

Scale your reporting framework to meet increasing demands

Crystal Enterprise provides you with a scalable, web-based solution for managing the access and delivery of hundreds or thousands of mission-critical Crystal reports to every decision-maker—across the enterprise and beyond.

As your company’s web reporting needs increase, you can upgrade seamlessly to Crystal Enterprise Professional without having to reinstall; you can also add additional licenses and components so that Crystal Enterprise grows right along with you.

Schedule reports to maintain up-to-date information

Schedule important reports to run on a regular basis so that everyone has access to the most current information about your enterprise.

Publish reports to the Web in seconds

With just a few easy steps, you can publish your reports to the Web for viewing by all with the Report Publishing Wizard.

Manage folders for sharing reports

Share reports across the enterprise or across the Web by publishing them to the default Guest favorites folder on the Automated Process Scheduler (APS). Users can also publish to other folders, as determined by the Administrator.

Administer easily from one central console

By consolidating administrative tasks, the Crystal Management Console (CMC) makes administering your web reporting solution quick and easy—regardless of the size of your enterprise.

Use the CMC to gain immediate control over what can or cannot be seen, run, or managed by everybody. You define all users’ viewing and managing privileges for particular reports.

Integrate Crystal Reports performance with existing IT investments

Trust your Crystal web reporting solution to work to its full potential with your existing web server investment.

Crystal Enterprise Standard has improved web server support, including compatibility with Domino web servers through DSAPI interface, and Apache servers through a DSO (Dynamic Shared Object) module on Solaris and Linux. Crystal Enterprise Standard also supports CGI on Solaris and Linux.

Use scripting on the Crystal Enterprise WCS

The Crystal Enterprise Web Component Server now provides complete support for scripting.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Complete XML support for the Web

Crystal Reports now fully supports the Extensible Markup Language (XML) adopted by the World Wide Web Consortium (W3C) for delivering content over the Internet.

XML is emerging as the standard data format for the whole data-related industry because it’s recognized across applications and across platforms. Keeping pace with the current advance in technology, Crystal Reports allows you to report off existing XML data and to export your work to XML format.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Access XML data at runtime

Use the Report Designer Component to access XML data streams at run time and pass that information to objects in report applications.

Note: For information on using XML, refer to the new “XML” chapter of the Crystal Reports User’s Guide.

Export report data straight to XML

Export your report data to XML format quickly at runtime. This allows you to send the data to other eCommerce applications used to read and manipulate information.

New properties have been added to the ExportOptions object to support these new features. These properties are:

 	XMLAllowMultiplePages

 	XMLFileName

Note: For more information see ExportOptions Object Properties.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Improved interactivity with parameters

Using parameters not only enables user-driven reporting, but also increases report performance, especially over the Web. Create multi-purpose reports to ensure that everyone receives the right information quickly.

All of Crystal Reports’ web-enabled report viewers have been improved to allow report designers and end users to utilize parameters to their full potential over the Web. Whether users prefer the Java, ActiveX, or DHTML viewers, they can interactively regulate the information they see by accepting default report parameters, picking from listed options, specifying multiple values, or entering ranges.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Customizable DHTML Report Viewer

Customize the Crystal Reports Dynamic HTML viewer to integrate seamlessly with the design of an existing eCommerce web site or corporate intranet. The DHTML viewer exposes the operations of its toolbar (via JavaScript), thereby giving report designers the ability to customize both its workings and its look-and-feel.

The enhanced DHTML viewer is so flexible that users can view reports, drill down on charts, link to on-demand subreports, or quickly export valuable data—all without even seeing that their experience is powered by Crystal Reports.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Display web reports independent of server location

Use Relative URLs to share your reports and their associated report objects on any server, in any directory. Each report remains independent of its actual location, because Relative URLs eliminate dependence upon any particular server or virtual directory.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Extend reporting abilities with additional applications

With Crystal Enterprise Standard, use the ePortfolio, other samples, or any client application designed by your Administrator (using the SDK) to access shared reports.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Additional Web reporting features

HTML and DHTML export

The performance of the HTML and DHTML export has been greatly improved.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Re-distribute the ASP Web Report Server

The enhanced ASP Web Report Server (rptserver.asp) is no longer dependent upon the Web Component Server, so developers can easily distribute their ASP web applications.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Facilitate administration with the license manager

Keep track of your Crystal Reports licenses and key codes with the License Manager (available only with Crystal Reports Developer Edition). This new administrative tool makes it easy for you to ensure that your product installation always meets your reporting needs. It also allows you to check the number of concurrent user licenses being used in the ASP environment. Access the License Manager from the Crystal Reports Tools program group on the Start menu.

Please note that the Report Designer Component will work only within the concurrent license limit when used as a reporting server.

Note: For more information see “Licence Manager” in the License help (License.hlp).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Designer Component 8.5 (RDC)

Designed for Microsoft Visual Studio and other COM-based development environments, the feature-rich Report Designer Component 8.5 (RDC) gives developers unprecedented control over report layout and formatting for web and Windows application reporting.

Reflecting the enhanced features of the Crystal Report Engine, the RDC now supports most of the new Crystal Reports features, including PDF export, XML export and data access, alerting, summaries for hierarchical groups, and many more.

Click the appropriate link to jump to that section:

 	Embed a Crystal Reports Designer in your application

 	Create and modify Report Alerts

 	Re-import subreports

 	Summarize on hierarchical data

 	Export to paginated PDF, and paginated RTF

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Embed a Crystal Reports Designer in your application

Your users can now design or edit reports at runtime with the Embeddable Designer. This easy-to-use ActiveX control provides the full power of Crystal Reports to your application. The control is placed on a form, or in a container within the form, and displays a new or existing report in design mode. This presents the user with an interactive environment in which to design or edit the report. The Embeddable Designer allows users to:

 	add data sources

 	add database fields

 	create and add formulas

 	create and add parameters

 	group data

 	summarize data

 	add charts

 	add subreports

 	add special fields

 	format fields and sections.

Note: For more information see Embeddable Crystal Reports Designer Control Object Model, and Programming the Embeddable Crystal Reports Designer Control.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Create and modify Report Alerts

Report Alerts are custom messages created in either the Crystal Reports Designer, the Report Designer Component, or the Embeddable Crystal Reports Designer Control. Report Alerts may indicate action to be taken by the user or information about report data. For more information see Report Alerts in the Crystal Reports User Guide.

Two new collections and two new objects have been added to the RDC object model to allow you to create, modify, and monitor Report Alerts at runtime. These collections and objects are:

 	ReportAlerts Collection

 	ReportAlert Object

 	ReportAlertInstances Collection

 	ReportAlertInstance Object

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Convert database drivers

The data source your report is pointing to can now be changed at runtime by converting the database driver. You can have this change reflected immediately in your application, or save the report, and have the change take effect the next time it is refreshed.

For more information see the ConvertDatabaseDriver Method (Database Object).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Re-import subreports

Subreports can be newly created in the main report or imported from an existing report file. If the subreport is imported from an existing report file, it can be re-imported at runtime using the ReImportSubreport method. When previewed, printed, or exported, a re-imported subreport will reflect all changes made to the formatting, grouping, and structure of the existing report file.

For more information see the ReImportSubreport Method (Subreport Object).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Summarize on hierarchical data

Make large, complex data sets easier to understand than ever by taking advantage of the new ability to create Subtotals, Grand Totals, and Summary fields for hierarchical groups: to do so, select the “Sum across hierarchy” option, which has been added to the Insert Subtotal, Insert Summary, Insert Grand Total, and Change Summary dialog boxes.

Hierarchical summaries can be enabled at runtime through the HierarchicalSummaryType property. This property has been added to the following two objects:

 	RunningTotalFieldDefinition Object

 	SummaryFieldDefinition Object

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Export to paginated PDF, and paginated RTF

Export your reports—in whole or in part—directly to the popular Portable Document Format (PDF), and then distribute these reports by email, over the Web, or in print. Alternatively, take advantage of the new Rich Text Format (RTF) exporting feature, which is based on the Crystal Reports Encapsulated Page Format (EPF).

In addition, Crystal Reports now supports page ranged export to PDF and RTF formats.

New properties have been added to the ExportOptions object to support these new features. These properties are:

 	PDFExportAllPages

 	PDFFirstPageNumber

 	PDFLastPageNumber

 	RTFExportAllPages

 	RTFFirstPageNumber

 	RTFLastPageNumber

Note: For more information see ExportOptions Object Properties.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Report Viewer

An integral part of the Report Designer Component, the Crystal Report Viewer offers full control over the previewing of reports in both client and Web environments. A new freeze pane feature and improved distribution further enhance the viewer’s functionality.

Click the appropriate link to jump to that section:

 	Freeze panes in the Crystal Report Viewer

 	Improve runtime distribution

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Freeze panes in the Crystal Report Viewer

The ActiveX viewer now has a feature similar to the Freeze Pane feature found in Microsoft Excel. In the ActiveX Viewer, right-click and select Freeze Pane from the shortcut menu to freeze the report from the bottom-right corner of the selected object. Unfreeze using the same menu. Scroll horizontally or vertically, and the report data scrolls as it would in Excel: vertical scrolling scrolls the portion of the report to the right of the selected object (above and below); horizontal scrolling scrolls the portion of the report below the selected object (left and right of the object).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Improve runtime distribution

Distribution of the Crystal Report Viewer (Crviewer.dll) has been simplified.Crviewer.dll is no longer dependent on the Urlmon.dll making for an easier installation of the RDC with your application.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Additional information

Crystal Reports product news

http://www.seagatesoftware.com/products/crystalreports/

Crystal Reports demos

http://www.seagatesoftware.com/products/crystalreports/showme/

Crystal Enterprise product news

http://www.seagatesoftware.com/products/crystalenterprise/

Product information

http://www.seagatesoftware.com/products/

Developer Zone

http://www.seagatesoftware.com/developerzone/

Online support, samples and tech briefs

http://support.seagatesoftware.com/homepage/

Training and consulting

http://www.seagatesoftware.com/services/

Seagate Software homepage

http://www.seagatesoftware.com/homepage/

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Key Features of Crystal Reports 8.x

This section highlights the key changes made for developers in versions 8, and it points you to further information. For a more complete discussion of some of the more major changes, see A Closer Look at Some of the New Features.

Click the appropriate link to jump to that section:

 	Report Integration controls for Visual InterDev

 	Lotus Domino sample applications

 	Enhancements to the Report Designer Component

 	API Enhancements from Crystal Reports 7 or earlier

 	A Closer Look at Some of the New Features

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Integration controls for Visual InterDev

The Report Integration controls allow Web developers using Microsoft Visual InterDev 6.0 to write Web applications that generate Crystal reports hosted on either a Web Reports Server or an ASP server. End users of these applications would then view these reports using a Report Viewer running on a browser.

You control such things as logging on to database servers, prompting of parameters and specifying selection formulas in these reports. You allow your users to view reports using either the Report Viewer for Java or the Report Viewer for ActiveX. You can also decide which properties to enable for the end user within the Report Viewer (printing or exporting, for example).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Lotus Domino sample applications

If you’re using Crystal Reports in conjunction with Lotus Domino, see the new Lotus Domino sample applications. These documents demonstrate how Crystal Reports increases the value of your Lotus Domino investment.

If you followed the default installation, you should find the sample documents in your Program directory (usually C:\Program Files\Seagate Software\Crystal Reports\Samples\En\Reports\Lotus Domino). You can also serve these reports up from within a Lotus Notes application by opening either Crazev6.nsf or Xglobal.nsf from within Lotus Notes.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Enhancements to the Report Designer Component

The Report Designer Component has seen the most changes including:

CRPE API

Report Variables

Set OLE Object Location

Save Preview Picture

Charts

Creating Reports at runtime using code

Cross-Tab reports

ADO and OLEDB Tables

Data Explorer

Select Distinct Records

Selecting & Editing Embedded Fields

Report Object Events

Formatting

Formulas

Grouping

IDE

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPE API

More of the CRPE API functionality is now available through the RDC.

The following new interfaces have been added:

 	ITableLinks

 	ITableLink

 	IFieldDefinitions

 	IObjectSummaryFieldDefinitions

 	ICrossTabGroups

 	ICrossTabGroup

 	ISubreportLinks

 	ISubreportLink

The following have been added to existing interfaces:

 	IDatabase

 	IDatabaseTables

 	IDatabaseTable

 	IFormulaFieldDefinitions

 	ParameterFieldDefinitions

 	ISQLExpressionFieldDefinitions

 	IRunningTotalFieldDefinitions

 	ISummaryFieldDefinition

 	IRunningTotalFieldDefinition

 	IReport

 	ISections

 	ISection

 	IGraphObject

 	ICrossTabObject

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Variables

Certain events, such as the OnSectionFormat event, may get fired more than once in a section. For example, a Details section may fire multiple times for a given record if the program is performing "Keep Section Together" calculations for the report. When you use VB variables that are supposed to increment once for each record (for example, when you calculate a running total), you can have problems maintaining state with these multiple firings.

To prevent these problems, the RDC now enables you to declare Report Variables. Report Variables are Crystal variables that you can use in your VB code. Report Variables "understand" what’s going on in the report and they increment appropriately. This enables you to do more of your coding than ever in VB and still get the results you expect. For more information, see Using Report Variables.

To support report variables, the methods AddReportVariable, GetReportVariableValue and SetReportVariableValue have been added to the IReport interface.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Set OLE Object Location

You can now set the location of an OLE object at runtime using the new method, SetOleLocation, under the ICROleObject interface. This also enables you to change an OLE object to point to different files at run time including image files.

The existing method, SetFormattedPicture, is still supported. However, if you use both SetFormattedPicture and SetOleLocation, SetFormattedPicture overrides SetOleLocation.

Also note that if an OLE object is in the Detail section and you call SetOleLocation in the OnFormat event for every detail record, this will affect your performance significantly.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Save Preview Picture

In the Crystal Report Designer, you now have the option to save a snapshot of the first page of a report for previewing in the File Open dialog box. This capability is supported in the RDC.

Two methods have been added to the Report Designer Component runtime under the IReport interface: get_SavePreviewPicture and put_SavePreviewPicture. You can use get_SavePreviewPicture to get the property and use put_SavePreviewPicture to set the property.

Note: You should be very careful to enable this flag at design time. If you don't and if the report contains thumbnail pictures, it can affect the performance when saving or loading the report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Charts

The following charting enhancements are carried through the Crystal Report Designer and the Report Designer Component:

Automatically Scale Data Axis

Two new runtime properties have been added under the class GraphObject: EnableAutoScaleDataAxis and EnableAutoScaleData2Axis.

Legend Enhancements

In the Report Designer Component runtime, the new enumerator type CRPieLegendLayout has been added, and the new property LegendLayout has been added under the class GraphObject.

Chart on All Records

Please refer to the Crystal Reports User’s Guide for a detailed description of this feature.

Chart on Running Totals

Please refer to the Crystal Reports User’s Guide for a detailed description of this feature.

Default Titles for Charts

Previously, when you used the Report Expert to create a chart, the expert assigned a title to the chart unless you specified one. Now the expert supplies the following titles by default: title, subtitle, footnote, group title, data title, data2 title and series title.

To support these enhancements, the following new properties have been added to the GraphObject class for the Report Designer Component runtime:

 	IsTitleByDefault

 	IsSubTitleByDefault

 	IsFootnoteByDefault

 	IsGroupTitleByDefault

 	IsSeriesTitleByDefault

 	IsDataTitleByDefault

 	IsData2TitleByDefault

Font Change for Chart Elements

You may now change the font used for chart elements. In the Report Designer Component runtime, properties have been added to the GraphObject class to change the font for these chart elements: title, subtitle, footnote, group title, data title, series title, legend, group labels, data labels and series labels.

New Formats for Data Points and Data Axes in Charts

Four new formats have been added to the Chart Expert to format data point values and data axis values: 1K, 1M, $1K and $1M.

In the Report Designer Component runtime, the following properties have been added to the GraphObject class to support this:

 	DataAxisNumberFormat

 	Data2AxisNumberFormat.

Creating Charts Based on a Cross-Tab

You may now create a chart based on a cross-tab object. A new method, AddGraphObject, has been added with the parameter pCrossTabObject. pCrossTabObject is optional, is a VARIANT type, and has to be a CrossTabObject. (For crGroupGraph and crDetailGraph, this parameter is ignored.)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Creating Reports at runtime using code

The RDC now includes Report Creation API methods. These methods enable you to create ad hoc reports at runtime using nothing but code. The methods can be used within Visual Basic, Microsoft Office, or in any environment from which you can access an automation server. Because these methods now enable Crystal Reports Designer functionality in your runtime applications, they require separate licensing.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Cross-Tab reports

Cross-Tab Formatting

The enhancements to the Crystal Report Designer for formatting cross-tabs (for example, predefined grid styles, formatting separate grid lines) are now also available in the Report Designer Component at design time.

Selecting & Formatting Cells in Cross-Tabs

You may now select individual cells in a cross-tab, or select multiple cells in a cross-tab, to format and re-size them. This is a design-time only feature.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ADO and OLEDB Tables

Two new methods have been added under the IDatabase interface to give you more control when working with ADO and OLEDB data:

 	AddADOCommand (connection, command)

 	AddOLEDBSource (connection, tableName)

These two methods enable you to add an ADO and OLE DB data source, save the report, and then refresh the report.

The methods from earlier versions, SetDataSource and Add (under IdatabaseTables) allow you to set a run time ADO record set as a data source, but the report saved will not be refreshed.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Data Explorer

The Report Designer Component has been enhanced to use the Data Explorer when you:

 	use a Crystal Report Designer driver to create a report through the Report Expert,

 	perform a Set Location, or

 	perform an Add Database.

When you create a report or do a set location, you now use the new Data Explorer to manage your database connections. The Data Explorer provides an integrated tree view of all data sources available to you.

For more information on the Data Explorer, please refer to Crystal Reports User’s Guide.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Field Explorer

The Field Explorer has been enhanced. It now includes an Unbound Fields node.

Unbound Fields

The RDC now enables you to create report templates based on unbound field objects. Then, using minimal code, you can bind those field objects to a data source (or one of several data sources) at runtime. The Report Engine uses the data type and the Name property of the unbound field object to match it with a data field in the recordset.

This functionality makes it easy to build reporting into n-tier applications where you have on-demand recordsets and non-continuous data connections. It also makes it easy to build a single report that can work with a variety of recordsets, making development and maintenance more efficient.

Unbound fields allow for great flexibility, since you can easily change the data source for an unbound field at runtime.

 	In the Visual Basic RDC design time environment, you can easily add unbound fields to your report by dragging and dropping any of the unbound field types from the Designer's treeview onto the report.

 	In the Report Designer Component runtime, you can add an unbound field object to a section using the new function AddUnboundFieldObject under the Section class.

 	To bind the unbound field to a database field at runtime, you can use the new method SetUnboundFieldSource.

 	Alternatively, you may use automatic unbound field binding, based on either the field name or the field name and value type of the field in the data source. To do so, you would use the new method AutoSetUnboundFieldSource, and specify one of the constants crBMTName or crBMTNameAndValue for CRBindingMatchType.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Select Distinct Records

You may now direct the RDC to select only unique records from a data source. In the IReport interface, EnableSelectDistinctRecords has been added to allow you to get or set this option based on user input.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Selecting & Editing Embedded Fields

If a database field is embedded in a text object, you can now select and edit the embedded objectfield as if it were not embedded. Note that the RDC allows you to manipulate embedded objects at design time only.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Object Events

BeforeFormatPage & EndFormatPage Events

The BeforeFormattingPage and EndFormattingPage events are fired before and after formatting a page respectively. These events enable you to make a variety of page-specific changes to your report.

You could, for example, reset Report Variables that you were using to calculate a subtotal on a page-by-page basis. Another possibility is to control the report formatting information as desired before the page is formatted.

Note: There are a number of properties and methods you cannot use in these events. For example, you cannot use the "SetText" method in BeforeFormatPage or EndFormatPage or you will get a runtime error. When the events are fired, the report is in Active formatting mode while the sections are in inactive formatting mode. Thus, you can use properties and methods that affect the report object, but you can't use properties and methods that affect anything in the sections of the report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldMapping Event

The FieldMapping event is fired if a database is changed while verifying database. Field mapping enables you to change the name of a database field that a report field points to if that field no longer exists or has been renamed in the data source. Verifying the database or using SetLocation will trigger the FieldMapping event.

Note: This event is fired only when the fieldmapping type is not set to automatic. If it is set to automatic (the default setting), the program will display a field mapping dialog box instead.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


NoData Event

The NoData event is fired when the data set in the report is empty. It enables you to stop the processing and/or invoke error handling.

Note: This event is fired only for the main report even if there is a subreport.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Formatting

Text Formatting

To complement the enhancements in the Crystal Report Designer on line spacing, character spacing, text rotation and indentation for text objects and string field objects, the Report Designer Component runtime has also been enhanced in the following ways.

In the ITextObject interface for text objects, and the IFieldObject interface for string field objects, these properties and methods have been added:

 	CharacterSpacing (read/write)

 	LineSpacing (read)

 	LineSpacingType (read)

 	SetLineSpacing (method)

 	TextRotationAngle (read/write)

 	FirstLineIndent (read/write)When reading, this method gets first line indent of the first paragraph; when writing, it sets first line indent for all the paragraphs.

 	LeftIndent (read/write)When reading, this method gets the left indent of the first paragraph; when writing, it sets the left indent for all the paragraphs.

 	RightIndent (read/write)When reading, this method gets the right indent of the first paragraph; when writing, it sets the right indent for all the paragraphs.

 	TextFormat (read/write)For text objects only.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Fractional Point Font Support

You may now specify a fractional point size for text objects and database fields, including the 10.5 point font commonly used in Japanese. To do so, type in a fractional point size in the Font tab of the Format Editor that you use to format a selected text object or database field.

Note: VB users cannot use this feature. While our own dialog box now supports fractional point sizes, Visual Basic does not support such sizes.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Accounting Conventions

To support conventions used in accounting, you may now control how the negative symbol, currency symbol and zero value are displayed, and reverse the sign when displaying numbers in accounting reports. To implement these conventions, the following properties have been added to the Report Designer Component runtime FieldObject class: UseReverseSign and ZeroValueString.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Formulas

Basic Syntax

The formula language in Crystal Reports 8 has been extensively enhanced with the addition of a new Visual Basic-like language called Basic syntax. It is an alternative to the formula language. Most new functions, operators, and control structures have been added to both Crystal and Basic syntaxes, and most existing Crystal capabilities have been duplicated in Basic as well. While existing Crystal Reports users do not have to learn this new syntax to utilize the extra capabilities, it is intended to be easy to learn and use for developers already familiar with Visual Basic.

Apart from the new functions, operators and control structures available in both syntaxes, Visual Basic developers who distribute applications can benefit from the fact that Basic formulas are portable and do not require any additional DLL’s to run.

You must use a single syntax within a given formula, but you may use formulas with different syntaxes in the same report. When you enter a formula (other than a selection or search formula - see note below) in the Formula Editor, you can choose either Crystal or Basic syntax as the default syntax for the formula.

New functions available to both syntaxes include:

 	financial functions

 	mathematics functions

 	programming shortcut functions

 	type conversion functions

 	date and time functions

 	array and string functions

 	percentage functions.

New operators available to both syntaxes include:

 	integer division

 	exponentiation

 	eqv

 	imp

 	xor

 	mod.

New control structures available to both syntaxes include:

 	for statement

 	do statement

 	select … case statement

For a more detailed description of these functions, operators and control structures, please refer to the Developer’s Help.

Note: The two syntaxes are fundamentally equivalent, with one exception: When you create or modify search or selection formulas using the Select Expert, the Search Expert, or the Formula Editor, you can only use Crystal syntax.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FormulaSyntax and LastGetFormulaSyntax

Two new properties have been added to the Report class for working with these two languages: FormulaSyntax and LastGetFormulaSyntax.

 	You can specify the syntax that you want to use before you create a formula via the FormulaSyntax property.

 	After getting formula text, you can use the property LastGetFormulaSyntax to determine the syntax used for the formula.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Grouping

Hierarchical Reporting

You may now use hierarchical grouping to arrange data in a report to show hierarchical relationships. You still keep all the elements of the hierarchy in the same table, but you can now display the relationships between the elements. This can be useful, for example, when reporting off a Human Resources database, to show the organizational hierarchy within a company.

In the Report Designer Component runtime, the following properties have been added to implement this grouping under the Area class:

 	EnableHierarchicalGroupSorting

 	ParentIDField

 	InstanceIDField

 	GroupIndent.

You can use the InstanceIDField and ParentIDField properties to organize the group sorting tree, use the GroupIndent property to design the layout, and use the EnableHierarchicalGroupSorting property to enable or disable hierarchical group sorting.

At design time you may select hierarchical grouping for your report in the Report Designer Component, by right-clicking and choosing Report|Hierarchical Grouping Options. This will invoke the Change Hierarchical Options dialog box.

For more information and an example of how to use this feature, please refer to the Crystal Reports User’s Guide.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


IDE

Toolbars

As in the Crystal Report Designer, toolbars now have an updated, flattened look, and can be moved. And, in particular to the Report Designer Component, the toolbars can also be resized to fit your needs.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


API Enhancements from Crystal Reports 7 or earlier

Those enhancements that correspond with Crystal Reports 7 or earlier versions include the following:

Tool Tips

Show Object Names for Fields

MTS Support

OLAP Grid Formatting

Exporting to Excel 7.0 and 8.0 Formats

Save As Version 7 Format

Optimized Group Tree Creation & Deletion

Printing

Searching

Summarizing

Viewer

Web

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Tool Tips

There are now tool tips for objects in the RDC design time that display the data type, object name, and field name for the object wherever applicable.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Show Object Names for Fields

In the RDC design time, you may now choose to display the object name for a field (the Name property as it appears in the VB Properties Window. You can set this option on the Layout tab of the Default Settings dialog box.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


MTS Support

The RDC runtime supports the apartment model (apartment threading) and can thus run under Microsoft Transaction Server (MTS). It does not support state free status, however, which means it cannot utilize certain MTS functionality.

When you install a component within MTS, MTS allocates a Transaction Support property that defines the way the component will behave. The property has four settings:

 	Requires a transaction.

 	Requires a new transaction.

 	Supports transactions.

 	Does not support transactions.

Because the RDC does not support state free status, when you install it to work within MTS, make certain you choose the "Does not support transactions" setting. This makes certain that the component will never attempt to run within a transaction. It will always run outside the transactions.

Note: RDC only supports MTS in ASP8. Therefore, you cannot use MTS in VB.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OLAP Grid Formatting

You may now import a report with an OLAP grid, select the grid and format it. When you right-click the grid, you can select Cut, Copy, or Format from the shortcut menu. If you choose Format, the program invokes the Format Editor with the Common and Border tabs.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Exporting to Excel 7.0 and 8.0 Formats

You may now export to Excel 7.0, 7.0 Extended, 8.0 and 8.0 Extended formats from the Report Designer Component runtime.

Now, under the IExportOptions interface, there are four new formats:

 	crEFTExcel70

 	crEFTExcel70Tabular

 	crEFTExcel80

 	crEFTExcel80Tabular

There are also six new Excel format option properties:

 	ExcelTabHasColumnHeadings

 	ExcelUseWorksheetFunctions

 	ExcelConstantColumnWidth

 	ExcelAreaType

 	ExcelAreaGroupNumber

 	ExcelUseTabularFormat

You can also export now to PDF and HTML 4.0 formats.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Save As Version 7 Format

The report file format has been changed in Crystal Reports 8.

 	In the Report Designer Component design time, you now have the option of saving the report in Version 7 or Version 8.

 	In the Report Designer Component runtime, there is a new method under the IReport interface, SaveAs, that allows you to specify in which file format (Version 7 or Version 8) you would like to save your report.

The previously used method Save is now hidden.

Note: Not all Version 8 reports can be saved in Version 7 format and still work properly. Reports containing the following features will not work properly in Version 7 format:

 	Formulas using the new Basic syntax

 	Formulas using new formula functionsReports created off OLE DB data source, especially if they use the extended style

 	Hierarchical grouping

 	Percentage summary fields

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Optimized Group Tree Creation & Deletion

Group tree creation and deletion at runtime have been optimized. Now you can begin viewing the first page of the report or navigating the group tree before the entire report and the entire group tree have been loaded.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Printing

Setting Printer Duplex and Paper Source

At runtime, you may set the printer duplex and paper source for the current report. There are two new properties that can be set and retrieved: PrinterDuplex and PaperSource. In combination with the existing properties PaperSize and PaperOrientation, you can precisely specify all aspects of the printer options.

Printer Setup Dialog

The Report Designer Component runtime has been enhanced with a new Printer Setup Dialog box. You invoke this dialog box using the new PrinterSetup method under the IReport interface.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Searching

String Search

You may now search for strings in text objects, field objects, subreports, cross-tabs and OLAP grids. You may now search field names (or object names if fields are displayed with these names instead) for strings. String searching also allows you to mark all report objects that match a string and then manipulate all these objects as a group.

Search By Formula Support

You can now search by formula in the Report Designer Component runtime. The Report Viewer will contain a boolean search button if you install the Search Expert.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Summarizing

Inserting Subtotal, Summary, Grand Total

Previously, in the RDC design time, you had to first find the database field you wanted to summarize and then right-click directly on that field before you could insert a subtotal, summary or grand total. In Version 8 you don’t have to do that any more. Now you simply right-click on an empty space in the design time report and pick from a list of fields to summarize.

In addition, when you insert a subtotal for grouped data, you now have two options:

 	to insert a subtotal or summary field all groups, or

 	to insert a grand total field.

Note that as before, if you are creating the summary for grouped data, and in the design view you have selected an object that cannot be summarized, then the menu item Insert | Summary will be disabled. The same applies to subtotal and grand total fields.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Inserting Running Total

The RDC design time now has a shortcut for creating running total fields based on a selected database field.

You simply right click a database field and select Insert Running Total from the shortcut menu that appears. This will invoke the Create Running Total Field dialog box which automatically sets up the running total for the selected field.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Percentage Summary Fields

The Report Designer Component now supports the new Percentage Summary field. A Percentage Summary Field enables you to show a subset of data as a percentage of the entire set. For example, you can use it to show the percent contribution of each sales rep to the sales for the entire company. Previously, this had to be done using formulas.

The following changes have been made to the Report Designer Component runtime to support Percentage Summary fields:

 	the type CRSTDPercentage has been added to the enumerator type CRSummaryType,

 	the functions Add and Delete have been added to the SummaryFieldDefinitions class.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Viewer

Select Expert and Search Expert Support for the Report Viewer

The Report Viewer now supports the Select Expert and Search Expert when used in conjunction with the RDC runtime.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Web

Hyperlinks

You may now select an object in the RDC design time and create a hyperlink to a Web site or email address.

To create a hyperlink to a Web site or email address, you simply right-click an object (e.g., text, bitmap, chart) in the Designer and select Format from the shortcut menu. Go to the new Hyperlink tab in the Format Editor and set up your link.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Speed Up Loading of First Page

In the RDC runtime, you can now have the program load the first page of a report even before the total page count is calculated. You can use a placeholder for the total page count for Page N of M, and when the total page count is ready, the program will insert it back to each page.

To support this feature:

 	the PlaceHolderOptions property has been added to the IPageEngine interface. You may use this property to specify whether or not you want to delay the total page count generation.

 	The IsMissingTotalPageCount property has been added to the IPage interface. You can use this property to find out whether a page is missing the total page count.

This feature is particularly useful if you use the Report Designer Component runtime to write Web reports, where the end-user can benefit from this improvement and view the first page of a large report much sooner than before.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Web Support

You may now access the Seagate Software Web page through the Report Designer Component for online registration, support, product news, and updates. To access the web page, right-click anywhere in the Designer, and choose Help|Seagate Software on the Web.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


A Closer Look at Some of the New Features

Overview:

Report Variables

Report Creation API

Using fields that bind to data sources only at runtime

Thin-client applications and meta-layer data

Field Mapping

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Variables

The RDC now includes Report Variables. These are "smart" variables that can be used to maintain state when you code things such as running totals based on a Section Format event. These variables understand what’s going on inside the report formatting process at any given time, and they enable you to do more of your report-oriented coding exclusively in VB. The discussion that follows explains why you might need to use report variables.

The RDC uses a multiple pass model to generate its reports. The number of passes the program needs to generate a given report depends on the complexity of the report. There is no "one size fits all" answer to the question, "How many passes will it take?"

During each pass, various sections in the report get fired. A Details section might get fired several times for a single record. This might happen, for example, when you have selected the "Keep Section Together" option and the program jumps back and forth between pages as it determines on which page it should print the section.

If you use a standard VB variable to calculate running totals, that variable is unable to use the built-in intelligence of the RDC. When a section is fired multiple times, the variable gets incremented each time the Format event for that section is trapped. In this case your calculations will be distorted. When you create a running total in the RDC using a Crystal Running Total field, however, the program knows to increment the field value only once for each record, regardless of how often the section is fired.

Note: The maximum allowable size for a string in a string Report Variable is 255 including the null byte. If you set a string value to more than 255, the string will be truncated.

For further discussion on "what happens when" during the report creation process, see the Report Processing Model appendix in the Crystal Reports User’s Guide.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using Report Variables

Instead of using the Dim statement to declare a Report Variable, you declare it by invoking the new AddReportVariable method when the Report Initialize event fires. This method requires you to supply a data type and variable name as parameters. For example:

Me.AddReportVariable crRVCurrency, "Total"

Note: Make certain you enclose the name of the variable in double quotes.

Once you have declared the variable, you can get its value using the GetReportVariableValue method that is part of the Report object. You can set or increment the variable using the SetReportVariableValue method. For example:

Me.SetReportVariableValue "Total", Me.Field3.Value + Me.GetReportVariableValue("Total")

Note: Report Variables are only available in RDC runtime. If you save a report as a .RPT file to use with standalone Crystal Reports, you will lose the capability of the report variable.

For further information on Report Variables, see the Report Variables sample application in the \\SeagateSoftware\Crystal Reports\Samples\En\Code\Visual Basic\Report Variables folder. For a description of the sample application, see Report Variables.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Creation API

The RDC now includes Report Creation API methods. These methods enable you to create ad hoc reports at runtime using nothing but code. The methods can be used within Visual Basic, Microsoft Office, or in any environment from which you can access an automation server.

The RDC also provides a Report Creation Wizard object that your application can call at runtime to enable your users to create reports at runtime using an intuitive design environment. The Wizard even attempts to identify your data source so it can make the data selection automatically.

The Report Creation API methods provide the application user with Report Designer capabilities even if they are not themselves registered users of Crystal Reports. For this reason, a new licensing model is in effect for these methods only. Please refer to the license material available from the help menu in the product for further information.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using fields that bind to data sources only at runtime

The RDC now enables you to create report templates based on unbound field objects. Then, using minimal code, you can bind field objects to a data source (or one of several data sources) at runtime. The Report Engine uses the data type and the Name property of the unbound field object to match it with a data field in the recordset.

This functionality makes it easy to build reporting into n-tier applications where you have on-demand recordsets and non-continuous data connections. It also makes it easy to build a single report that can work with a variety of recordsets, making development and maintenance more efficient.

To take advantage of this functionality:

1	Add the RDC to your project. For further information, see Adding the RDC to your project.

2	Choose the Unbound Fields option from the Field Explorer in the RDC.

3	Choose a field object by data type and drag it into position where you want it to appear on your report.

4	Set the Name property of the field object to match the name of the field in your recordset that you want it to bind to.

5	Continue until you have all your fields in place.

6	Write the code to activate the binding. This code example binds to a database table.

In the code, set up an Object variable for your report. For example:

Dim Report As New CrystalReport1

7	Then to create the binding, code using the new Report object method AutoSetUnboundFieldSource:

Report.AutoSetUnboundFieldSource crBMTName

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Thin-client applications and meta-layer data

The discussion of unbound fields makes it look like it is extremely easy to create unbound report templates that bind to their data sources only at runtime. It is easy, but that easiness masks, somewhat, the power of this new capability. It should not be underestimated. You can use that capability to build thin-client applications that report off of meta-layer data.

If you have been interested in having your applications utilized by larger corporations, you know that you have been forced to consider a more server or multi-tiered approach. Organizations interested in keeping up with the times have been forced to move to larger customized applications for solutions like ERP systems. This combination of technology adoption has required developers, and the tools they use, to advance beyond simple applications that connect directly to a data source.

From a reporting perspective this means that you need a way to take advantage of the meta-layers within an ERP solution.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The meta-layer

A meta-layer is an intermediate data layer that holds a subset of the data in the original data source. The data in the meta layer typically has already been summarized, manipulated, and/or cleansed. Meta-layers are used when it becomes too complicated for users to understand or connect to the raw data itself.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The application and the reports

Your other challenge is based on the customizing of these systems. There is no standard database format; it is different for every company. To provide a solution, you must create client server applications that can extract the data from a meta-layer and then utilize the extracted information within the reports you provide for your users. Crystal Reports 8 takes advantage of two features to provide an answer:

 	The ability to link a report to an ADO record set.

 	The ability to create a report template using unbound fields.

Linking a report to an ADO recordset is not a new feature, but is closely associated with the new Unbound Fields capability. An unbound report field:

 	is a field type that you add to a blank report during the development of an application

 	has no data source until the user executes the report at runtime

 	acts like a placeholder on the report in situations where you don’t have access to the user’s data source.

This is the case, every time you write an application that is meant to connect to a customized ERP type application! Now you have a solution:

 	The final application extracts data from the meta-layer and writes it to an ADO object.

 	The RDC connects to the ADO object at runtime and populates the Unbound Field objects.

By designing your application using unbound report templates, you can still give users the ability to generate reports against this data, even though at design time the data doesn’t exist.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Web-based thin-client solutions

You can also use this entire solution over the web for a true thin-client implementation You can use the same set of code (Com objects) to extract the data from the custom system and its meta-layer, and pass it to an ADO object. The CRAXDRT (using unbound fields) can then access this ADO record set and publish the report.

The main difference is that the report ends up being produced in an EPF format instead of RPT and it gets fed back to the user via the Web server in a viewer rather then in a preview window of an application.

To provide such a web solution, you would need to do your development in an ASP environment rather than a Windows-based development environment like VB, VC++ or Delphi.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Field Mapping

When you first create a report, the report draws its fields from the data source as it exists at that time. It uses the structure of the database (number of fields, field position, data type, etc.) to identify and select those fields you want placed on the report. If the structure of the database gets changed (by adding or deleting fields) after you create the report, you need to adapt the report to the new structure. The RDC now has a robust set of Field Mapping tools that you can use to accomplish this.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The FieldMapping event

In the past you have been able to use the Verify method in the Database object to verify that the structure of the data source matches that of the data source used in the report. This checks for prior changes to the structure. Now you can determine if the data source structure gets changed while you're verifying it by trapping the new FieldMapping event. The RDC fires a FieldMapping event when there is a change to the structure during the verify process.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The FieldMappingData object

The RDC also has a New FieldMappingData object that enables you to bind a report field object to a data source with a different table and/or field name, or with a different data type than that in the report. The FieldMappingData object has four read/write properties that enable you to map the changes in the data source to the database field objects in your report. These properties are FieldName, MappingToFieldIndex, TableName, and ValueType.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Integration Methods

This section is to gives you an understanding of how integrating Crystal Reports into your applications has evolved. You will also learn the benefits of using the latest technology—represented in the Report Design Component (RDC). This technology will enable you to take full advantage of the powerful Crystal Report Print Engine and create the best applications available today.

Click the appropriate link to jump to that section:

 	Overview

 	Integration methods

 	The Report Designer Component

 	The Best Tool for Your Needs

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview

Crystal Reports is the world standard for desktop and web reporting. The Developer Edition includes many innovative features for developers who need to integrate sophisticated reporting into their Visual Basic, Visual C++, Visual J++, Office, Java, Lotus Notes, and Delphi applications.

The methods developers use to integrate reporting into their applications have evolved over time. Industry leaders such as Microsoft have focused their efforts on integrating new technologies into their developer software to make it easier to create powerful applications. As companies such as Microsoft have introduced these advancements, Crystal Reports has kept pace to ensure developers can take advantage of these advancements when using our software.

Note: Visit the Seagate Software Developer Zone web site at http://www.seagatesoftware.com/products/dev_zone. Click Support to get links for finding documentation and knowledge base articles about integrating reporting in your applications.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Integration methods

You can choose to access the Crystal Report Print Engine and integrate Crystal Reports’ functionality into your database applications in a variety of ways:

 	Report Designer Component Runtime (RDC)

 	Crystal Report Automation Server

 	Crystal ActiveX Control (OCX)

 	Crystal Report Print Engine API

 	Crystal Visual Component Library (VCL)

When they were first introduced, each of these methods represented the latest technology available at that time. Today, you can take advantage of the full power and functionality of Crystal Reports by using the Report Designer Component, our most recent technology.

Method
Introduced in version
Project Reference Name
Description
Report Designer Component
Crystal Reports 7
Crystal Report 8 ActiveX Designer Runtime library (craxdrt.dll)
32-bit only COM object model, dual interface, apartment model
Crystal Reports Automation Server
Crystal Reports 6
Crystal Report Print Engine 8 Object Library (cpeautl6.dll/cpeaut32.dll)
32- and 16-bit COM object model, dispatch only Interface for C developers
Crystal ActiveX Control (OCX)
Crystal Reports 4.5
ActiveX Control (crystl16.ocx/crystl32.ocx)
32- and 16-bit OCX
Crystal Report Print Engine API
Crystal Reports 3
Crystal Report API Interface, declares encapsulated in GLOBAL32.bas
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Report Designer Component

The Report Designer Component (RDC) offers a dual interface COM component which is the most advanced technology available for developers. It is an ActiveX Designer that utilizes the reporting power of Crystal Reports. If you’re creating applications in popular environments such as Visual Basic, Visual C++, Visual InterDev and Office 2000 (VBA), you can use the RDC to efficiently create the most powerful reporting functionality in your applications

Although the RDC is our latest integration technology, Crystal Reports 8 supports the older integration methods (32-bit only). We recommend, however, that you begin using the newest and best reporting technology available—the RDC—to create powerful reports that support the entire range of functionality available within Crystal Reports.

To better understand why the RDC offers the best solutions, it’s important to understand its architecture and how it relates to different types of developers.

The RDC consists of three main components:

 	Report Designer: for Visual Basic and Office 2000 (developer edition with VBA 6.0) developers, this component lets you create, view and modify reports directly in the Visual Basic or VBA Integrated Development Environment (IDE).

 	Automation Server: an extensive object model with hundreds of properties and methods you can use to program a report.

 	Report Viewer: used to preview reports on screen, the Report Viewer gives you great control and flexibility over the viewed report. It’s a lightweight ActiveX control that contains an extensive object model. The viewer is customizable and allows you to add a custom toolbar if needed.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Visual Basic and Office 2000 (VBA) Developers

Because the report designer is an ActiveX designer, it is easy for Visual Basic and VBA developers to use:

 	The report designer is closely integrated with Visual Basic 5.0 and 6.0 and VBA 6.0, and it allows you to open, design, and customize reports directly from the Visual Basic or VBA IDE.

 	Report Experts guide you in creating the report you need, allowing you to quickly and easily design reports.

 	You can use familiar Visual Basic code to create even more advanced functionality.

 	The RDC is an easy way to give your applications powerful reporting capabilities.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Visual InterDev Developers

Many Visual InterDev developers are experienced with using Visual Basic, and are therefore familiar with integrating reports into database applications. Developers can use the same RDC automation server and Report Viewer in Visual InterDev as they use in other COM-based environments such as Visual Basic and Visual C++ to access the features of Crystal Reports. This provides one object model that offers the same control over the report engine in web applications as well as Windows applications. Developers can save time since they can build a report once and move it to either the desktop or the Web. Report Integration controls then give Visual InterDev developers an easy way to integrate reports into ASP pages.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Visual C++ Developers

If you use a development environment such as Visual C++ that supports COM, you can:

 	create reports in Crystal Reports

 	use the RDC's automation server and viewer to manipulate and preview those reports at runtime.

You will save time writing code, and can use the RDC to integrate reporting in the most logical and efficient way.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Evolution of Integration Capabilities of Crystal Reports

The integration technology available to developers has progressed in parallel with advancements in the developer market. Crystal Reports has quickly adopted the leading concepts and architecture implemented for Visual Basic, Visual C++, and other development environments. The following is an overview of how the application integration methods offered in each version of Crystal Reports have evolved over time.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Report Print Engine API

Since Version 1, Crystal Reports has exposed the Report Engine functionality via a C API that you could use to make direct Report Engine calls.

Using these direct Report Engine calls you can access more functionality than offered with the OCX. However, because it was designed for C/C++, it wasn’t easy to use the API inside Visual Basic and some of the API wasn’t available because of Visual Basic limitations in creating C style structures.

As a Visual Basic developer, you needed to add more code—and in many cases complex code with multiple parameters—into an application to execute a report. This was especially time consuming if you were unfamiliar with API calls.

If you have used the Report Engine API, the RDC is appealing because it offers additional functionality, and is a much easier way to experience the power of the Crystal Report Print Engine.

The Crystal Report Engine API is only available in standalone versions of Crystal Reports (i.e. version 8). No new features will be added in future releases of Crystal Reports.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Crystal ActiveX Control (OCX)

The Crystal ActiveX Control (OCX) is one of the oldest development technologies available to developers in Crystal Reports. When OCX was first released in Crystal Reports 4.5, it was based on the latest ActiveX technology from Microsoft, thus offering state-of-the-art reporting for Visual Basic developers. Today, however, its capabilities pale in comparison to the power and flexibility available in the RDC.

 	The OCX control lacks programming depth and complete Report Engine functionality.

 	While the Crystal Report Engine provides features that are conducive to a hierarchical object model—where each report is broken down into sections with objects—this type of hierarchy isn’t represented in an OCX control. At the time of its original development, the OCX revolutionized report integration because it provided developers with a graphical interface to integrate existing reports. But all of the Report Engine features can’t be represented in the flat model allowed by the OCX.

 	In addition, the OCX is a wrapper around the Report Engine, which means it is less efficient and requires the distribution of more runtime components than using the RDC.

Today, the OCX supports only the smallest subsets of Report Engine functionality—the most common properties and methods. Although it’s supported in newer versions, no new features have been added since Crystal Reports 6.

If you’re a Visual Basic developer who has used the OCX, you will find the RDC easier to use inside the familiar Visual Basic IDE and by taking advantage of Report Creation experts.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Report Automation Server

Based on the Crystal Reports 6 Object Model, the Crystal Report Automation Server uses a hierarchical object model, unlike the "flat" model of the OCX.

 	The Automation Server provided the first object-oriented interface to the Report Engine.

 	It was also the first object model in Crystal Reports that allowed Visual Basic developers to access all the Report Engine features, something C/C++ developers had enjoyed since the beginning.

It was built around the Report Engine DLL. It behaved as a translation layer, taking Visual Basic code and converting it into Report Engine calls. Because of its inability to directly access the Report Engine, the Crystal Report Automation Server wasn’t as efficient as it could be.

We’ve ensured backward compatibility in Crystal Reports 8 to allow you to leverage applications created in the previous version. However, the Crystal Report Automation Server no longer exposes all of the events and properties of the Report Engine in Crystal Reports 8. Because the Report Designer Component is COM-based, and an evolution of the Crystal Reports Automation Server, you will find it easy to migrate from the Crystal Reports Automation Server to the RDC.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Designer Component (RDC)

The RDC—introduced in June 1998 as a component of Crystal Reports—represents a major reengineering of the Crystal Report Print Engine. Unlike any of its predecessors, the RDC is not a wrapper; it exposes all Report Engine objects directly without any translation. The RDC is based on the same object model as the Crystal Report Automation Server. Because it is not a wrapper, the RDC is a much more efficient COM object that supports features such as dual interface, providing a more efficient way of making calls to the Report Engine.

The primary advantage of using the RDC over other developer tools within Crystal Reports is its code writing and formatting capabilities in popular development environments such as Visual Basic. The RDC provides events that enable you to manipulate the report at runtime. Within these event handlers, you can access text or field objects to modify the output of a report based on user input. Setting text in text objects or field objects, or dynamically changing pictures in picture objects, are added features unique to this interface.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Best Tool for Your Needs

We recommend that you use the RDC to take advantage of the best functionality and features available. While we support applications created using other tools like the OCX and the Crystal Report Print Engine APIs, the RDC offers more power and is easier to use.

New features of the Crystal Report Print Engine are only available through the RDC. If you’d like to integrate them into your applications, you must change the code. Links to resources (technical briefs and tutorials) to help you migrate to the RDC are located on the Seagate Software Developer Zone web site.

Visit the Seagate Software Developers Zone at http://www.seagatesoftware.com/products/dev_zone to find information on the resource that best suits your needs. Chapter 9, Migrating to the RDC from the OCX of this guide shows you how to move quickly to the RDC from the OCX.

The RDC is the premium development method, and it will continue to be enhanced for developers. The latest version of the RDC is included in Crystal Reports 8.5.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Migrating to the RDC from the OCX

This section is to illustrates the benefits of using the RDC for integrating reporting functionality into your Visual Basic applications. Learn how to migrate applications from the OCX to the RDC to take advantage of the latest features within Crystal Reports. Also included is an overview of the RDC, its major components, object model, and a description of its advanced features not available within the OCX.

Click the appropriate link to jump to that section:

 	Overview

 	OCX

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview

Since it was first included in Microsoft Visual Basic, Crystal Reports has become the world standard for desktop reporting and design. It has kept pace with technological advancements by giving Visual Basic developers new ways to integrate reporting into database applications. For example, the Crystal ActiveX Control (OCX)—the tool most Visual Basic developers are familiar with—was first introduced in 1995 with Crystal Reports 4.5. In June 1998, the Report Designer Component (RDC) was launched. It’s a revolutionary tool designed specifically for Visual Basic developers to create, view and modify reports within the Visual Basic Integrated Development Environment (IDE).

Note: Visit the Seagate Software Developer Zone web site at http://www.seagatesoftware.com/products/dev_zone. Click Support to get links for finding documentation and knowledge base articles about integrating reporting in your applications.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Summary

The RDC represents the latest in ActiveX technology and provides the following advantages over the OCX:

 	Integrates directly into the Visual Basic IDE.

 	Allows you to create, view, and modify reports using Reports Experts and familiar Visual Basic code.

 	Exposes all Print Engine features and provides the greatest number of events and objects to write code to.

 	Performs better because it is a dual interface component with no wrapper around the Print Engine.

 	Takes advantage of code completion features that are easy to use in the Visual Basic editor.

 	Is fully compatible with Microsoft Visual Basic 5.0 and 6.0.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OCX

OCX is the development interface most Visual Basic developers are familiar with because it has been a part of Crystal Reports since 1995. The OCX is based on an older version of ActiveX technology. All of its properties and methods are accessed through a single control. This limits your control of a report because it exposes only a subset of the Crystal Report Print Engine’s functionality.

In addition, because the OCX acts a wrapper around the Print Engine, it’s less efficient when loading a report because it can’t directly access the Print Engine.

Code Comparison between the OCX and RDC

The RDC is based on the current generation of Microsoft ActiveX technology. It’s the method Visual Basic developers must use to take full advantage of the features within the Crystal Report Print Engine. Applications that are created using the OCX will not be able to use the latest Crystal Reports technology. If you’re planning future releases or new applications, and you’d like to use the most powerful and flexible tool, you should consider using the RDC.

You can benefit from using the RDC by getting increased control over reports, such as:

 	flexible formatting like passing text to a text object

 	enhanced printer control

 	creating report templates with unbound fields and then binding the fields to a data source (or one of several data sources) at runtime

 	report Variables that enable you to maintain state even if a report section needs to fire multiple times for a given record

 	the Create API which lets you create new objects, and even new reports, at runtime using code

 	the latest Print Engine features such as mapping and multiple parameters

 	and most importantly, the ability to create, view and modify reports inside the Visual Basic IDE.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OCX and RDC sample application comparison

OCX sample application
RDC sample application

Below are two applications which provide similar functionality—the first is created using the OCX, the second uses the RDC. The RDC example shows how to create a new application or convert an existing OCX application. With very few exceptions, you can duplicate any properties and methods set by the OCX using the RDC. Its properties and methods are very similar to the OCX, greatly reducing the time it takes you to learn the product.

The major differences between the two applications include:

 	Setting the Crystal-related Project References and Components.

 	Setting or accessing objects to get to the properties or methods needed for the report.

 	The addition of the Crystal Report Viewer for viewing reports.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Sample Application General Description

A report with a subreport is created off the xtreme.mdb database.

 	The main report contains the Customer table and a parameter field.

 	The subreport contains the Orders table and a formula field.

The OCX application consists of a Form with three Command Buttons and the OCX control.

Form Load:

 	The Report is opened.

 	The location of the database in the main report is changed.

 	The parameter in the main report is set.

 	The subreport is opened.

 	The location of the database in the subreport is changed.

 	A string is passed to the formula field in the subreport.

Command1

The report is previewed to screen

Command2

 	The printer is selected

 	The report is printed

Command3

 	The export options are set to export the report to a Rich Text Format

 	The report is exported

A second form will be added when the application is created using the RDC. The Crystal Report Viewer is added to the second form for viewing the report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OCX sample application

Project|References:

No Crystal References required

Project|Components:

Crystal Report Control

Form1

Private Sub Form_Load()

Open the report.

CrystalReport1.ReportFileName = App.Path & "\OCX_to_RDC.rpt"

Change the location of the database.

CrystalReport1.DataFiles(0) = App.Path & "\xtreme.mdb"

Pass the parameter value to the main report.

CrystalReport1.ParameterFields(0) = "Param1;Main Report Param;True"

Pass the selection formula to the main report.

CrystalReport1.ReplaceSelectionFormula _

"{Customer.Last Year’s Sales} < 50000.00"

Open the subreport.

CrystalReport1.SubreportToChange = "Sub1"

Change the location of the database in the subreport.

CrystalReport1.DataFiles(0) = App.Path & "\xtreme.mdb"

Pass the formula to the subreport.

CrystalReport1.Formulas(0) = "Formula1= " & "'Subreport Formula'"

Set CrystalReport1 back to using the main report.

CrystalReport1.SubreportToChange = ""

End Sub

Private Sub Command1_Click()

Set the destination to window.

CrystalReport1.Destination = crptToWindow

Preview the Report.

CrystalReport1.Action = 1

End Sub

Private Sub Command2_Click()

Set the printer driver.

CrystalReport1.PrinterDriver = "HPPCL5MS.DRV"

Set the printer port.

CrystalReport1.PrinterName = "HP LaserJet 4m Plus"

Set the printer name.

CrystalReport1.PrinterPort = "\\Vanprt\v1-1mpls-ts"

Set the destination to printer.

CrystalReport1.Destination = crptToPrinter

Print the report.

CrystalReport1.Action = 1

End Sub

Private Sub Command3_Click()

Set the Report to be exported to Rich Text Format.

CrystalReport1.PrintFileType = crptRTF

Set the Destination to Disk.

CrystalReport1.Destination = crptToFile

Set the path and name of the exported document.

CrystalReport1.PrintFileName = App.Path & "\OCXExport.rtf"

Export the report.

CrystalReport1.Action = 1

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RDC sample application

To migrate this application to the RDC, remove the OCX component from Form1, and remove the Crystal Report Control from the Project|Components menu, in addition to the steps below:

Project|References

Reference the Crystal Report 8 ActiveX Designer Runtime Library

Project|Components

Crystal Report Viewer Control

Add a second form

Add the Crystal Report Viewer Control to Form2

The properties and methods are accessed from individual objects. Following this code sample is a detailed description on the RDC Automation Servers Object Model.

The RDC will open a standard Crystal Report (.RPT). The Report could have been Imported into or recreated in the RDC ActiveX Designer (.DSR).

Form1:

Declare the application object used to open the rpt file.

Dim crxApplication As New CRAXDRT.Application

Declare the report object.

Public Report As CRAXDRT.Report

Private Sub Form_Load()

Declare a DatabaseTable object for setting the location of the database. This object will be used for the main and subreport.

Dim crxDatabaseTable As CRAXDRT.DatabaseTable

Declare a ParameterFieldDefinition object for passing parameters.

Dim crxParameterField As CRAXDRT.ParameterFieldDefinition

Declare a Report object to set to the subeport.

Dim crxSubreport As CRAXDRT.Report

Declare a FormulaFieldDefinition object for passing formulas.

Dim crxFormulaField As CRAXDRT.FormulaFieldDefinition

Open the report.

Set Report = crxApplication.OpenReport _

(App.Path & "\OCX_to_RDC.rpt", 1)

Use a For Each loop to change the location of each DatabaseTable in the Reports DatabaseTable Collection.

For Each crxDatabaseTable In Report.Database.Tables

     crxDatabaseTable.Location = App.Path & "\xtreme.mdb"

Next crxDatabaseTable

Set crxParameterField to the first parameter in the parameterfields collection of the main report.

Set crxParameterField = Report.ParameterFields.Item(1)

Pass the value to the main report.

crxParameterField.AddCurrentValue "Main Report Parameter"

Set crxSubreport to the subreport 'Sub1' of the main report. The subreport name needs to be known to use this method.

Set crxSubreport = Report.OpenSubreport("Sub1")

Use a For Each loop to change the location of each DatabaseTable in the Subreport Database Table Collection.

For Each crxDatabaseTable In

     crxSubreport.Database.Tables

          crxDatabaseTable.Location = App.Path &

          "\xtreme.mdb"

Next crxDatabaseTable

Set crxFormulaField to the first formula in the formulafields collection of the subreport.

Set crxFormulaField = crxSubreport.FormulaFields.Item(1)

Pass the formula to the subreport.

crxFormulaField.Text = "'Subreport Formula'"

End Sub

Private Sub Command1_Click()

Call Form2 to preview the Report.

Form2.Show

End Sub

Private Sub Command2_Click()

Select the printer for the report passing the Printer Driver, Printer Name and Printer Port.

Report.SelectPrinter "HPPCL5MS.DRV", "HP LaserJet 4m Plus", "\\Vanprt\v1-1mpls-ts"

Print the Report without prompting the user.

Report.PrintOut False

End Sub

Private Sub Command3_Click()

Declare an ExportOptions Object.

Dim crxExportOptions As CRAXDRT.ExportOptions

Set crxExportOptions to the Report object's ExportOptions.

Set crxExportOptions = Report.ExportOptions

Set the report to be exported to Rich Text Format.

crxExportOptions.FormatType = crEFTRichText

Set the destination type to disk.

crxExportOptions.DestinationType = crEDTDiskFile

Set the path and name of the exported document.

crxExportOptions.DiskFileName = App.Path & "\RDCExport.rtf"

Export the report without prompting the user.

Report.Export False

End Sub

Form2:

Private Sub Form_Load()

Set the Report source for the Crystal Report Viewer to the Report.

CRViewer1.ReportSource = Form1.Report

'View the Report

CRViewer1.ViewReport

End Sub

Private Sub Form_Resize()

This code resizes the Report Viewer control to Form2's dimensions.

CRViewer1.Top = 0

CRViewer1.Left = 0

CRViewer1.Height = ScaleHeight

CRViewer1.Width = ScaleWidth

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Introducing the Report Designer Component

This section introduces the Report Designer Component (RDC) and explains it’s architecture along with some possible development scenarios. It also provides additional sources for help and information on the RDC, including sample applications that present the RDC in real-world scenarios.

Click the appropriate link to jump to that section:

 	The Report Designer Component

 	How to Get Additional Information

 	Sample Reports

 	Sample Applications

 	Report Wizard

 	Complex Applications

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Report Designer Component

The Report Designer Component (RDC) is a powerful solution for Visual Basic developers who quickly and easily integrate reporting into their database applications. It’s an ActiveX designer object that packs the reporting power of Crystal Reports into a lightweight add-in for Visual Basic 5.0 or 6.0. You can open, design and customize reports within the Visual Basic IDE. In addition:

 	Intuitive Report Experts make it flexible and efficient to connect to data and integrate powerful reports into applications.

 	With hundreds of report properties, methods and events, you have complete control over your report designs, using familiar Visual Basic code.

 	Report distribution is simplified through a small component count and free runtime.

 	Reports can be packaged within the applications' executable or stored outside the application in the traditional (.rpt) format.

Note: Get the latest news about the Report Designer Component from the Seagate Software Developer Zone web site at http://www.seagatesoftware.com/products/dev_zone.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Design time

At design time, the Report Designer Component provides a user interface that closely integrates with the Visual Basic IDE. Through the user interface, you design and manipulate reports and report data. This interface includes events that can be directly programmed from within Visual Basic.

The Report Designer Component uses the Active Data Driver for connecting to ISAM, ODBC, and SQL databases through Data Access Objects (DAO), Remote Data Objects (RDO), ActiveX Data Objects (ADO), and Data Environments (Visual Basic 6.0 only). You can design the data set from within Visual Basic, then apply it to the report contained by the Report Designer Component.

When working in Visual Basic, you will often need to use the Report Viewer for ActiveX as a user interface to display reports. The Report Viewer is an ActiveX control that you can drop to a standard Visual Basic Form. The Report Viewer is where your report is displayed at runtime.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Runtime

The user interface provided by the Report Designer Component at design time does not appear in your application at runtime, or when it is compiled into an executable file. Instead, the Report Designer Component is accessed directly by your Visual Basic code. New for version 8.5 is the Embeddable Crystal Reports Designer Control. This allows you to provide your users with the ability to design or edit Crystal Reports within your application using the same interface as the design time control. However reports can be opened and saved only in the Crystal Report format (.rpt) and not in the ActiveX Designer format (.dsr) of the design time control.

The Report Designer object model provides a complete object hierarchy for direct manipulation in Visual Basic. The object model can be accessed through both the RDC runtime engine and the RDC design and runtime engine. See CR Automation Server for more information.

The Active Data Driver is also available at runtime, through the Report object of the Report Designer Component object model, and can be assigned a new set of data based on user interaction with your application. You design a Recordset or Resultset object in Visual Basic using the DAO, RDO, or ADO object model, and pass it to the report.

Finally, the Report Viewer takes center stage at runtime, connecting to the Report Designer Component and displaying the embedded report. With careful design and placement on the Form, the Report Viewer appears as a window inside your application.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RDC Architecture

If you aren’t familiar with the RDC, you should note that it consists of five components. Together, these components enable you to create, design, edit, program, and preview, print, or export your reports:

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Designer

The Report Designer is integrated tightly within the Visual Basic 5.0 and 6.0 IDE, enabling you to create, view, and modify reports without leaving Visual Basic. This component was specifically created for Visual Basic developers.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Automation Server

There are two automation servers provided with the RDC. The Crystal Reports ActiveX Designer Runtime Library (craxdrt.dll)—known as the RDC runtime engine, and the Crystal Reports ActiveX Designer Design and Runtime Library (craxddrt.dll)—known as the RDC design and runtime engine. Both offer the same extensive object model with hundreds of properties and methods for you to use to manipulate the report at runtime. See Unification of the RDC object model for more information on when to use each automation server.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Report Viewer

The Crystal Report Viewer is an ActiveX control that you can use to preview reports on screen. The viewer is loaded with customization options to give you great control over your interface and over the viewed report itself.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Embeddable Crystal Reports Designer Control

The Embeddable Crystal Reports Designer Control (Embeddable Designer) is an ActiveX control that you can use to allow your users to design and edit Crystal Reports in your application at runtime.

Component
Description
Crystal Report Designer UI Component (craxdui.dll)
A COM (Component Object Model) component that provides the user interface at design time for the user to interact with and create or modify the report.
Crystal Report Designer Design and Runtime Time Component (craxddrt.dll)
An underlying COM component that provides services for the user interface component. The component also encapsulates all of the report objects and is responsible for all of the data processing and report layout. Use this component with client based applications that incorporate the Embeddable Designer.
Crystal Report Designer Run Time Component (craxdrt.dll)
The component that encapsulates all of the report objects and is responsible for all of the data processing and report layout. Use this component with any Client based or server side application that does not incorporate the Embeddable Designer.
Active Data Driver (p2smon.dll)
A data access driver that provides access to various types of object data sources including DAO, RDO, and ADO.
Crystal Report Viewer for ActiveX (crviewer.dll)
An Active X control which can be drawn on a form and manipulated at design time. It provides a rich object model used to modify user interaction with the report at runtime. This component is required only if a developer wants to provide on-screen display of reports at runtime.
VB Form
The Crystal Reports Report Viewer Control must be embedded on a Visual Basic Form in order to display the report on screen. The Create Report Expert can automatically add a Form with the Report Viewer embedded to the project when you finish designing a report with the Expert.
Data Set
One of the following:
Data Access Object (DAO) Recordset
Remote Data Object (RDO) Resultset
Active Data Object (ADO) Recordset
VB Data Environment
Crystal Data Object (CDO)
Crystal Data Source Type Library object
ODBC Direct
These objects do not need to be valid at design time. For example, you could construct a report template at design time without the data being available. This is handled through
Data Definition Files
. However, the data set objects must be present and valid at runtime to generate a report.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Combinations of RDC Components

The three RDC components can be used together or individually, in any combination. The following table identifies which of the components you need to use in your project:

Using the Report Designer with the Automation Server
VB and VBA only
for designing reports within IDE and manipulating the reports with code
not necessary to preview the reports
reports can be printed or exported
use the Crystal Formula Language, VB or VBA code for expressions in the report.
Using all three RDC components
VB and VBA only
want to design reports within IDE and manipulate the reports with code
reports can be previewed, printed or exported
use the Crystal Formula Language, VB or VBA code for expression in the report.
Using the Automation Server and the Crystal Report Viewer
VB and VBA, C++, Visual InterDev, Visual J++
want to design reports using Crystal Reports, preview from application, and manipulate the reports with code
reports can be printed or exported
use the Crystal Formula Language, VB or VBA code for expressions in the report.
Using the Automation Server, Embeddable Designer, and the Crystal Report Viewer
VB and VC++
want to allow your users to design or edit their own Crystal Reports
reports can be saved, printed, exported and previewed.
use the Crystal Formula Language, VB or VBA code for expressions in the report.
Using the Automation Server by itself.
VB and VBA, C++, Visual InterDev, Visual J++
want to design reports using Crystal Reports and manipulate the reports with code
reports can be printed or exported
use the Crystal Formula Language, VB or VBA code for expressions in the report.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding the RDC to your project

The installation program will attempt to add the menu item Add Crystal Reports 8 to the Project menu of the VB IDE when you install the RDC. If that menu item appears, you simply select it to add the RDC to your project.

If the menu item does not appear on the Project menu, you will first need to add it manually, and then you can add the RDC to your project.

To add the RDC to your project

1	Choose Components from the Project menu.

2	Click the Designers tab in the Components dialog box when it appears.

3	Select Crystal Reports 8 on the Designers tab. This will add the menu item to the Project menu.

4	Finally, select Add Crystal Reports 8 from the Project menu.

The RDC is now ready to use within the VB IDE.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


How to Get Additional Information

Seagate Software supplies an extensive set of tools to help you master the RDC quickly and easily. These include:

Crystal Reports User’s Guide

The Seagate Software Web Site

Object Browser

Properties Window

Sample Reports

Sample Applications

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Reports User’s Guide

Since the capabilities of the RDC mirror the capabilities of Crystal Reports, you can use the Crystal Reports User’s Guide to learn about the RDC’s powerful reporting capabilities. For example, if you want to learn the details of the Select expert, how to link a subreport to its parent report, or just more general information on report creation, you should refer to the User’s Guide. This documentation is available in printed form as well as a searchable electronic (PDF) form on the CD. You can find the User’s Guide (Usergde.pdf) in the Docs folder on the CD.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Seagate Software Web Site

Seagate Software provides a wide range of developer support information and tools on its web site at http://www.seagatesoftware.com/products/dev_zone.

The web site offers these support tools and more:

 	Downloadable files and product updates.

 	Developer samples.

 	A comprehensive knowledge base showing solutions and workarounds to a wide range of technical problems.

 	Technical briefs, detailed documents that discuss complex issues and/or explain how to use various sophisticated product features.

 	FAQs: quick answers to your most common questions.

 	Release Notes: details about known issues, product features, enhancements, and fixes.

The web site is updated continually so you will always be able to find current information to help you with your development challenges.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Object Browser

A source of support for many VB programmers is the VB Object Browser. Use the Object Browser to navigate the RDC automation server object model (CRAXDRT), the Report Viewer object model (CRVIEWERLibCtl), the various objects used in your project (Project n), and the VB and data object models. The Object Browser introduces you to the hierarchy of the object models, and provides you with useful information about the various classes and members in the object models.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Properties Window

The RDC exposes each object in an RDC report. This means you can view all of the design time properties and options in the Properties Window of the VB IDE. Simply select an object in the report and you can see and set its various properties visually.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Sample Reports

The program includes many sample reports you can use to learn sophisticated reporting techniques. With a full installation, you can find these samples in the \Crystal Reports\Samples\En\Reports folder.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Sample Applications

Crystal Reports contains over 18 Visual Basic sample applications. These applications show you how to use the RDC in real-world situations.

With a complete installation, you will find the sample applications in the \\Seagate Software\Crystal Reports\Samples\En\Code\Visual Basic folder. There are samples for C++ and the Web in the \Code folder. The sample applications provide you with one of the most direct and tested methods for learning the RDC.

The applications contain usable code that can be modified and plugged into your own programs. They also present great ideas for using the RDC. By studying these ideas, you may be able to generate new business by offering clients sophisticated capabilities.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Visual Basic Samples

The following sample applications have been created for Visual Basic developers:

Simple Application

ADO Connection Methods

Change Runtime Location of OLE Object

Employee Profiles

Inventory Demo

Load Picture Demo

Microsoft Office Samples

No Data in Report Event

Printer Settings

Report Object Creation API

Report Variables

Report Wizard

Search and Select Experts

Simple Demo

Unbound fields

Viewer

Viewer Runtime options

Complex Applications

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Simple Application

Most of the sample applications focus on solving a single problem or a small set of related problems. If you’re a first time user of the RDC, you’ll find the application called Simple Demo a good place to start.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ADO Connection Methods

This application demonstrates the two new methods to add ADO data sources to a report:

 	AddADOCommand takes an active ADO connection and ADO command object as parameters. In this example, a new connection is created to a database, and the resulting recordset is assigned at runtime to the report.

 	AddOLEDBSource takes as parameters the name of an active ADO connection and the name of a table that can be accessed through that connection. In this example, the connection setup through the VB Data Environment is used as a data source.

Both methods can be used with either the VB Data Environment or another data source created at runtime.

Note: Notice in the Designer that there is no data source attached to the report at design time.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Change Runtime Location of OLE Object

This application demonstrates how you can set the location of an OLE object at Runtime using the SetOleLocation command.

This application takes three different OLE objects:

 	a bitmap

 	part of an Excel spreadsheet

 	part of a Word document.

This application cycles through them so a different object gets printed each time the Details section gets formatted.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Embeddable Designer Control

This application demonstrates how to include the Embeddable Crystal Reports Designer Control in an application. It shows how to add a new or existing report to the Embeddable Designer, how to display the report in the Crystal Report Viewer, and how to refresh the report in the Crystal Report Viewer so it displays any changes made in the Embeddable Designer.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Employee Profiles

This application demonstrates how you can set and format the text in report text objects at runtime.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Inventory Demo

The Inventory Demo is a sample application that displays a report. It shows you how to use the Report Initialize section for report level manipulation. It also includes how to change the BackColor of the report Details section conditionally for those items that need to be ordered.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Load Picture Demo

The Load Picture application shows you how to load a picture into the report at runtime. It also shows you how to change some of the values and properties of some of the text objects in the Details section of the report at runtime.

The program also shows you ways to implement calculations and calculated fields in the RDC. The two methods are:

 	using the Crystal Formula Language

 	using VB code in the Section_Format event procedure.

This example describes how to perform calculations in the Section_Format event using VB.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Microsoft Office Samples

Visit the Seagate Software Developer Zone web site at http://www.seagatesoftware.com/products/dev_zone. To search for Microsoft Office sample applications click Support, and then click the Download Files and Updates link.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


No Data in Report Event

This application demonstrates the new NoDataInReport event.

The "No Data" event is triggered when the data set in the report is empty. In this sample, the code applies a filter to the data that causes the report to have no data. It then traps the NoDataInReport event and displays a message box that allows the user the option to view the report without any data or just to view a blank page.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Printer Settings

This application demonstrates how to change the report printer settings at runtime using code.

 	There are four new report properties that allow you to easily retrieve and set PaperSize, PaperOrientation, PaperSource, and PrinterDuplex for the report printer options. All of these are demonstrated.

 	There is also a new method called PrinterSetup that provides a Windows standard printer setup window to allow the user to change the printer properties directly at runtime. This is demonstrated as well.

The two methods are independent of each other. For example, changing the Windows standard printer setup will not alter the report printer settings and vice-versa. These new properties and the new method give you much more control over how the report is printed.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Object Creation API

This application demonstrates the use of the new Report Object Creation API.

The Creation API functions allow runtime creation of report objects, including text, database field, unbound field, chart, special, box, cross-tab, BLOB field, line, picture, summary, and subreport objects.

 	You can add these report objects at runtime to an existing report that you created in the RDC.

 	You can also create a blank report at runtime and add these objects to that blank report. This sample demonstrates the second method.

All properties that are normally available for each object at runtime are also available for the objects you create.

This sample shows you how to create text, database field, unbound field, summary, picture box and line objects. For information about more advanced uses of the Creation API, please see the Pro Athlete Salaries sample application.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Variables

This application demonstrates the use of the new Report Variable capability.

The RDC now includes Report Variables. These are “smart” variables that can be used to maintain state when you are coding items such as running totals based on a Section_Format event. These Crystal variables can be used in your VB code. They understand what’s going on inside the report formatting process at any given time, and they enable you to do more of your report-oriented coding exclusively in VB.

This sample describes how to use Report Variables to calculate totals based on only part of the data. Since Report Variables accept any valid value from the VB environment, you can use values that only exist at Runtime to change the formatting of your report.

In this sample, there are three columns based on a database: one column of currency values, one column of integer values, and one column of non-integer values.

 	The first column changes to a blue color when the sum of the values in the column is greater than a random value. A total is displayed in the lower part of frmMain showing the total of the values colored blue.

 	Records in the second and third columns change color when the sum is greater than a different random value. The sum is then reset. This can be useful if you wish to start and restart a totalling operation in the middle of a report.

 	A String Report Variable is used to build a string consisting of the first digit of each green highlighted value. You could use this method to easily extract individual string values from a report field.

Note: Report Variables can only be set and retrieved while the report is formatting.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Wizard

You can use the Report Wizard with the Report Creation API to enable users to create entirely new reports at runtime and then view or save the report. When you implement the Wizard, you save yourself the necessity of writing “create” code for each of the objects your users put into their new report. This application shows you how easily you can implement the Wizard in your code.

You can also use the Report Wizard as a starting point for creating a custom report wizard that allows you to set your own defaults for report creation.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Search and Select Experts

This application shows you how to control the Search and Select Wizards in the Report Viewer using code.

The Search and Select Wizards allow advanced filtering and highlighting of data displayed in the ActiveX viewer. In this sample, two different methods of using the Search and Select Wizards are demonstrated:

 	Two command buttons on the main form display a search or select wizard with predefined fields and ranges already set for the user. The only displayed fields and ranges are those that have been added at runtime.

 	The Search and Select Expert buttons on the top right part of the viewer are over-ridden, allowing you to specify default criteria to search for. Alternatively, the default search and select experts can also be displayed.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Simple Demo

This simple demonstration presents an introduction to the Report Designer. Many of the basic methods used in manipulating and creating reports are discussed in the code comments. This is a good starting point if you are unfamiliar with the RDC.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Unbound fields

This application shows you how to create a report template using the new Unbound Fields capability. It also shows you how to bind the fields at runtime to a data source that you also create at runtime.

In this sample, there are five unbound fields created in the report. Notice that there is no data source added to the report at design time at all—the data source is created and added to the report at runtime.

You can also use Unbound fields in formulas, although this sample does not demonstrate this use.

Unbound fields give you great flexibility in your programming. They even allow you to create a single report template that can be bound to a variety of data sources at runtime in response to user input. This enables you to create a wide range of custom reports all from a single template. See the Pro Athlete Salaries application for a demonstration of this capability.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Viewer

This simple application shows you how you can create your own Report Viewer toolbar and manipulate the ActiveX viewer using your own custom buttons.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Viewer Runtime options

This application demonstrates the many ways you can manipulate the Report Viewer at runtime. It also shows you how to implement the use of the Select Expert and the Search Expert in the Viewer.

All of the check boxes on the main form correspond to viewer properties that you can change at runtime. In this sample, there are more than 21 viewer properties that are manipulated. Note that to enable the Select Expert and Search Expert, you must reference the Crystal Select Expert OLE control module and you must place the Select Expert Control on the form.

The Select/Search Expert is essentially invisible on the form and is located immediately to the left of the About Sample Command Button in this sample.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Complex Applications

The following three applications are large and complex. They each demonstrate many of the RDC capabilities.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Xtreme Mountain Bikes

This application was included with Version 7. It has been updated in this version to showcase many of the new RDC capabilities.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Pro Athlete Salaries

This application shows a very sophisticated use of the Create Report API, Unbound Fields, and a previously-undocumented method for using the Tables.Add method. This report is worth studying because it demonstrates the powerful things you can do with the RDC through code alone.

Note: The Designer does not appear in the Project Explorer. This is because the report is actually a template report created at runtime using Unbound Fields and the Create API, and the fields are bound at runtime to a custom recordset generated at runtime based on user input.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


First Class Hotels

The sample demonstrates a number of Crystal Reports features that are new to version 8, as well as possible advanced uses for some existing features.

The main form in the sample, frmMain, is used for managing the reservations. Some features include:

 	The report displayed in the window is automatically updated whenever a reservation is added, the customer name changed, or the date range changed.

 	Double-clicking on a customer name or room number in the report will bring up a form containing information about that customer or room.

 	Clicking on one of the two miniature notepad icons in this window will also cause this same information report to be displayed.

 	The billing report that can be displayed by double-clicking the report, or clicking the notepad icons, only displays information between the start and end dates shown at the bottom of the reservation form.

The Room form, frmRoom, contains these features:

 	Allows adding/removing of hotel room numbers

 	Clicking on the miniature notepad icon in this window will cause the information report to be displayed. The information will be displayed for all dates that the room has been used and is not restricted by a start or end date.

The Price form, frmPrice, contains these features:

 	Allows adding/removing of hotel room prices.

 	Customer: Allows adding/editing/removing of customers.

 	Clicking on the miniature notepad icon in this window will cause the information report to be displayed. The information will be displayed for all dates that the customer has stayed at the hotel and is not restricted by a start or end date.

This application uses many of the methods from earlier releases as well as this release. Here is a list to help you determine if this application has the answers you’re looking for (* denotes new in version 8):

Crystal Reports Viewer Object

Methods:
Properties:
Events:
PrintOut
EventInfo.Text
DblClicked
Refresh
EventInfo.Type
ReportSource
ViewReport
Crystal Reports Report Object

Methods:
Properties:
Events:
*AddReportVariable
Get and Set PaperSize
*BeforeFormatPage
*GetReportVariable
Get and Set PaperOrientation
*EndFormatPage
*SetReportVariable
*Get and Set PrinterDuplex
Initialize
RecordSelectionFormula
*Get and Set Papersource
*NoData
*SetUnboundFieldSource
Database.Tables().Location
Section_Format
LeftMargin
RightMargin
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Quick Start for using the RDC

This section helps you get started using the Report Designer Component (RDC) in Microsoft Visual Basic. Three examples provide you with the basic skills needed to use the RDC. You will find a high-level explanation of the steps required to add the RDC to a project, a tutorial on adding an existing report to the RDC, and a tutorial on creating and modifying a new report.

Click the appropriate link to jump to that section:

 	Overview

 	Bullet Point Quick Start

 	Open an Existing Report

 	Create and Modify a Report

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview

Using the RDC will add powerful reporting capabilities to your application, and you can do it all from the Visual Basic IDE.

Note: For information on using the RDC with other development environments, see Working with Visual C++ and Visual InterDev.

The following three sections were designed to get you started with the RDC:

Bullet Point Quick Start

If you only need minimal instructions for using the RDC, this section is for you. It includes a higher level, bulleted explanation about how to create, view, and manipulate a report through the RDC.

Open an Existing Report

If you have created a report in the standalone version of Crystal Reports and you want to open it through the RDC and preview it in the Report Viewer, you will find this section useful. It includes a lower level, step-by-step approach.

Create and Modify a Report

If you want to create, preview, and manipulate a report through the RDC, you will find this section extremely useful. This is also a lower-level, step-by-step approach. It mirrors the procedure of the Bullet Point Quick Start but describes each of the bullet points in more detail.

If you have questions that are not answered by these samples, please see the Sample Applications at \Crystal Reports\Samples\En\Code.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Bullet Point Quick Start

To add reporting capabilities to your application using the RDC:

 	Add the RDC to your project

 	With a complete install, the option Add Crystal Reports 8 appears on the Project menu in the VB IDE. Select Add Crystal Reports 8.

 	If the option does not appear, select Components from the Project menu and check the Crystal Reports 8 option on the Designers tab. Then select Add Crystal Reports 8 when it appears on the Project menu.

 	Select a data source

When you add the RDC to your project, the program presents the Crystal Report Gallery dialog box. If you’re not familiar with Crystal Reports, choose the Using Report Expert option and choose Project data from the Data tab in the Standard Report Expert when it appears. This enables you to select the newest technology, the Active Data recordsets for building your report. Select one of the ODBC(ADO) data sources from the combo box, add a new data source, or supply a connection string for an ADO OLE DB connection.

 	Create a report

From the Standard Report Expert, you can build your report by adding fields, setting up grouping and totalling, specifying your sort options, adding charts and selection criteria if you wish, and even adding a professionally designed look. You can do that by using the various Expert tabs.

 	Add the Report Viewer to your project

When you select Finish in the Standard Report Expert, the program automatically adds a form to your project and installs the Report Viewer on the form. It also writes the necessary code for displaying your report in the viewer and resizing the viewer whenever the form is resized.

 	If you don’t want the Viewer installed automatically, or if you don’t want the Viewer form to be your start-up form, you can change those actions in the Default Settings dialog box.

 	You get to the Dialogue by right-clicking in the RDC and selecting Designer and then Default Settings from the shortcut menu when it appears.

 	Create a UI for users to modify the report at runtime

Now that you have a report, you may want to manipulate it with code based on user input. If you haven’t done so already, here is the point where you could build the UI for the user using Visual Basic.

 	Write the code that does the modifications

Now you can write the code that ties the users UI selections to the report.

 	Each object in the report is exposed in the Properties window of the VB IDE.

 	Double-click any object and you can write code for the object.

 	Double-click on a section of the report and you can write code that affects the section and the objects in the section.

 	By referencing an object name in your UI code or the object index through one of the many Collections, you can manipulate that object directly based on user input.

 	Preview, print, or export the report

When you have completed the above, you can run the application and preview, print, or export the report using the UI controls you’ve set up to do it.

Now you have integrated the most powerful reporting tool into your application.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Open an Existing Report

In this example, you will open an existing report file in Visual Basic. This will demonstrate how to import existing reports (*.RPT files) and enable you to become familiar with the Report Designer Component user interface. This tutorial uses Crystal Reports 8 and Microsoft Visual Basic 6.0.

Ensure that you have completed the installation of the Report Designer Component files and make note of the installation directory if you did not accept the default selection.

To open a Report directly within Visual Basic 6.0

1	Open Visual Basic and create a new Standard EXE project by selecting Standard EXE from the start up dialog or selecting it from New Project under the File menu.

2	Add the Report Designer Component to Visual Basic if not already added during the installation process.

3	From the Project menu, select Components.

4	Click the Designers tab and check Crystal Reports 8. Click Apply and then click Close. The Report Designer is now available in this project and any projects you create in the future.

5	Now we need to insert the Report Designer into the project form. On the Project menu, point to More ActiveX Designers and then click Add Crystal Reports 8.

6	The Crystal Report Gallery appears displaying the different types of Report Experts that are available. Since you will be opening an existing report file, click From an Existing Report. Click OK.

7	Browse to the report called World Sales Report at \Crystal Reports\Samples\En\Reports\General Business. Click Open. Depending on your setup, you may be presented with a dialog that asks you about adding a form at runtime. Click OK.

8	The Report Designer Component is added to your project and the report layout is displayed in the design window. Report files created in any version of Crystal Reports can be imported in this manner. Before you run the report, right-click on Form2, and select View Code. You should see Visual Basic code that looks like this:

Dim Report As New CrystalReport1

Private Sub Form_Load()

     Screen.MousePointer = vbHourglass

     CRViewer1.ReportSource = Report

     CRViewer1.ViewReport

     Screen.MousePointer = vbDefault

End Sub

Private Sub Form_Resize()

     CRViewer1.Top = 0

     CRViewer1.Left = 0

     CRViewer1.Height = ScaleHeight

     CRViewer1.Width = ScaleWidth

End Sub

This default code, inserted by the Report Designer Component, will point the runtime Crystal Report Viewer at the report to display the results. This makes it easy to flip between the report design window and the finished report. You can add to or modify this code, but for now we’ll just view the report.

9	From the Run menu select Start (F5) or click on the Start button on the Visual Basic toolbar. After a few seconds, you will see a form displaying the finished report in the Crystal Report Viewer. You can resize the form by dragging the lower right hand corner of the Viewer. You can save this project if you like, but it will not be required to complete the steps in the next section.

Now that you have opened and viewed a report, feel free to go back and explore some of the right-click and property settings in the Report Designer window. You may also want to browse the CRViewer class of the CRVIEWERLibCtl object to see some of the properties and methods that you can use to customize the appearance of the viewer at runtime.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Create and Modify a Report

In this example, we’ll create and modify a simple report using the Report Designer Component. This will guide you through the basic steps in connecting to a data source and creating a report. The report you will be creating is a Sales by Region report based on a Microsoft Access database. We'll use the Report Experts to help create the report quickly and easily, then we'll modify some of its properties and make it more interactive by adding some event-driven code.

This exercise only touches on a few of the hundreds of properties and methods available but will give you an idea of how simple it is to fully integrate and customize reports in your Visual Basic projects.

To Add the RDC to your project

1	Open Visual Basic and create a new Standard EXE project by selecting Standard EXE from the start up dialog or selecting it from New Project under the File menu.

2	Add the Report Designer Component to Visual Basic if not already added during the installation process.

3	From the Project menu, select Components.

4	Click the Designers tab and check Crystal Reports 8. Click Apply and then click Close. The Report Designer is now available in this project and any projects you create in the future.

5	Now we need to insert the Report Designer into the project form. On the Project menu, point to More ActiveX Designers and then click Add Crystal Reports 8. (In some environments, Add Crystal Reports 8 will appear as an option itself on the Project menu.)

To Select a Data source

1	Check Using Report Expert and select Standard. Click OK. The Standard Report Expert appears. This window allows you to select from either Project or Other data sources. Typically, you use a project-based data source. The Other option enables you to use the native data drivers included with Crystal Reports.

2	We’ll connect to the ODBC data source using ADO. Click the Project button.

3	The Select Data Source window appears with ODBC selected by default. Select Xtreme Sample Database from the list of data sources. To see which options are available, click Advanced. The Advanced Options dialog appears. Click OK to accept the default of connecting using ADO.

4	Now that you’ve specified the data source and connection method, you need to specify which tables to use. Click Next in the Select Data Dialog. This brings up the Select Recordset dialog.

5	Select Customer from the object list and click OK to return to the Data Tab. The item ado should be displayed in the Tables list box.

To Create a report

1	Now that you’ve selected the database and the table, you need to specify the fields to include in the report. Click Next to move to the Fields tab.

2	Select the Customer Name database field from the Available Fields list, then Click Add to add the field into the Fields to Display box. Do the same for the Last Year’s Sales, City and Region fields.

3	Click on the Group tab and select the Region field, then click Add to add the field into the Group By box. Do the same for the City field. This will group your data by Region and, within each region, by City. By default, the Sort Order for the Region and City Fields is in Ascending Order.

4	Click the Total tab. Because Last Year’s Sales is the only numeric field in the report, the Report Expert automatically selects it for totaling.

5	Click the Top N tab. For the Region Tab, choose Sort All Groups based on Sum of Last Year’s Sales. Do the same for the City tab.

6	Click the Chart tab and click the Pie in the Chart Type list on the Chart|Type tab. Select the pie chart with 3D visual effect.

7	Click the Chart|Data tab. The Report Expert automatically selects to create the chart based on the sum of Last Year’s Sales.

8	Click the Chart|Text tab. In the Title box, type “Sales by Region”.

9	Finally, to give the report a professional look, go to the Style tab in the main set of Expert tabs and select the Executive, Trailing Break style. Click Finish. The RDC creates your report.

To Add the Report Viewer to your project

1	The Report Expert presents you with the option of adding a form with the Crystal Report Viewer control and setting this as the start-up object. Click OK to accept the defaults. The Expert will format the report and display it in the design window.

2	Click the Start button on the Visual Basic toolbar or press F5 to run your project. After a few seconds, you will see a form displaying the finished report in the Crystal Report Viewer.

This exercise has shown the basic steps for creating a new report. Although you don’t always have to use the Report Experts, they make connecting to your data source and creating the initial report fast and easy. You can then alter the look and feel of the report using the Report Designer window. Common tasks like field formatting, adding text and modifying field positions can be accomplished by dragging fields or altering their properties. These can be set using Visual Basic code or in the Visual Basic object properties window.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Create a UI for users to modify the report at runtime

When you add report capabilities to your application, you provide the user with a UI for customizing their reports (setting the date range for the report or deciding whether they want to see a detail or summary report for example). Rather than demonstrating how to build a UI (which is a VB procedure outside the scope of this tutorial) the next section shows you how to customize the report by hard-coding the modifications. With a UI, you would pass your user’s selections in place of the hard code.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Write the code that does the modifications

This report is currently based on all regions. We’ll modify the selection criteria to include only data from the USA. But first you may need to add a reference to your project.

1	Close the Crystal Report Viewer.

2	From the Project menu select References.

3	Check the Microsoft ActiveX Data Objects Recordset 2.0 Library and click OK.

4	Double-click Form2 from your Project Explorer to open it. This form contains the Report Viewer. Double-click on it to see the code in the main window. It should look something like this:

This code should appear in the General Declarations section.

Dim Report As New CrystalReport1

This code should appear in the Form_Load event procedure. It tells the viewer what report it should display and then it tells it to display (view) the report.

Private Sub Form_Load()

     Screen.MousePointer = vbHourGlass

     CRViewer1.ReportSource = Report

     CRViewer1.ViewReport

     Screen.MousePointer = vbDefault

End Sub

This code should appear in the Form_Resize event procedure, it resizes the viewer every time the form is resized.

Private Sub Form_Resize()

     CRViewer1.Top = 0

     CRViewer1.Left = 0

     CRViewer1.Height = ScaleHeight

     CRViewer1.Width = ScaleWidth

End Sub

5	To add selection criteria to the report. Edit the "Form2" declarations and "Form_Load" procedure to look like this:

Dim Report As New CrystalReport1

Dim rs As New ADOR.Recordset

Private Sub Form_Load()

     Screen.MousePointer = vbHourGlass

     rs.Open "Select * from customer where country = 'USA'", "xtreme sample database"

     Report.Database.SetDataSource rs,3,1

     CRViewer1.ReportSource = Report

     CRViewer1.ViewReport

     Screen.MousePointer = vbDefault

End Sub

This adds a query to select only the records with "USA" in the "Country" field. The recordset that results from that query will be passed to the report engine and the results displayed.

6	Run the report again to see the changes. Your report should only contain USA data.

7	Now we'll add a text object to the report and manipulate it using code. In the main Report Designer window, right-click just to the right of the graph in the Report Header pane and point to Insert, then select Text Object.

8	Move the text object just above the pie graph. You may have to move the graph down a bit first. Make note of the Name in the Properties window. In this example, the name is "Text5" but the name in your project may be different.

9	Now we'll set the contents of the text object you just added. Open the "Section5" code for editing in the Text Object by double-clicking on the Report Header [Section5] and add some code to the "Section5" "Format" procedure as shown.

Private Sub Section5_Format(ByVal pFormattingInfo As Object)

     Text5.SetText "Here is some text from my app"

     Text5.Font.Italic = True

     Text5.Font.Bold = True

     Text5.Font.Size = 14

End Sub

10	This will set the text object, change the font to Italic, Bold 14 point and display the results. Run the report again to see the changes.

To complete this exercise, you'll now add some event-driven code to explore how you can make the run time viewer control more interactive.

11	With the Form 2 code window open, use the Object and Procedure list boxes to select the "CRViewer1" object and add the "DrillOnGroup" and "PrintButtonClicked" procedures to the "Form2" code. Edit these new procedures as shown below:

Private Sub CRViewer1_DrillOnGroup(GroupNameList As

Variant, ByVal DrillType As

CRVIEWERLibCtl.CRDrillType, UseDefault As Boolean)

     MsgBox "You're drilling down on the " &

     GroupNameList(0) & " group!"

End Sub

Private Sub CRViewer1_PrintButtonClicked(UseDefault As Boolean)

     MsgBox "You clicked the Print button!"

End Sub

12	The "DrillOnGroup" procedure is triggered when the user double-clicks on any graph pie slice or report summary field. When this occurs, the text shown will appear in a message box. The "PrintButtonClicked" procedure works similarly when the viewer Print button is clicked. Try both of these procedures to make certain your code works as expected.

Now that you've seen a few simple ways to modify a report, you may want to explore some of the other properties and events in the report engine that you can use in your application. For more sophisticated programming examples, consult the sample applications. For more details on specific methods, properties, or events, use the VB Object Browser or consult the developer’s help files.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RDC Data Access

This section explains data access through the Report Designer Component (RDC), and describes how to connect to a data source through the Data Explorer. It also provides information on Active Data, the Microsoft Data Environment, and the database drivers used by the RDC.

Click the appropriate link to jump to that section:

 	Overview

 	The Data Explorer

 	Active Data Sources

 	Data Environments

 	Database Drivers

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview

In response to the question, “What data can I use when building reports in the RDC?”, the answer is, “You have virtually no limitations.” The RDC has been designed to use virtually any data source with minimal work on your part.

The Report Designer Component supportsdata access through Data Access Objects (DAO), Remote Data Objects (RDO), and ActiveX Data Objects (ADO). Through these three access methods, you can connect to most ISAM, ODBC, and SQL data sources available to Windows applications. In addition, you can create DAO Recordsets, RDO Resultsets, or ADO Recordsets in Visual Basic, then replace the data source used by a report at runtime by calling the SetDataSource method of the RDC runtime Report object.

The Report Designer Component also provides the ability to design reports based on Data Definition files, text files that define the fields, and field types of a database without actually serving as a source of data. Using Data Definition files, you can design a report without depending on the existence of a database at design time, then dynamically create the data at runtime and assign it to the Report object of the Report Designer Component.

If you have installed the full Crystal Reports product, you also have the ability to use the Report Designer Component to connect to any data source that Crystal Reports can connect to. In such a case, the Report Designer Component implements the Crystal Reports user interface that you are already familiar with, so you can quickly connect to any existing data.

Finally, the Report Designer Component also supports Data Environments in Visual Studio 6.0.

Probably the best way to cover all of the data sources is to take a brief look at the Data Explorer dialog box. This dialog box appears when you select Add Database to Report or Set Location, and it lists data source options in a hierarchical tree view.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Data Explorer

The top three nodes in the Data Explorer were designed to make it more efficient for you to return to favorite data sources, current connections, or data sources you have used in the past. Those nodes are all intuitive, and they are discussed in depth in the Crystal Reports User’s Guide. We’ll be discussing the bottom three nodes in this section.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ODBC

The first of these nodes, ODBC, shows a list of ODBC data sources that you have already configured for use. These are local and remote data sources that are not accessed through an object model such as ADO or DAO. The Report Designer Component can use the same database drivers for these data sources that are available through Crystal Reports.

Note: To use these drivers, you must install the full Crystal Reports product.

You can either use an existing data source or create a new one by selecting the Create New Data Source option. If you select, Create New Data Source, the RDC displays a Wizard that leads you through the creation process.

You will need to supply:

 	the type of data source you want to create

 	the driver you want to use

 	any driver-specific information that is required.

If you are setting up a machine-independent File Data Source, you will also be asked to supply the name of the file data source you want to save the connection to.

Once you’ve supplied this information, the Wizard sets up the data source for you.

To connect to an existing ODBC data source:

1	Choose the data source.

2	Choose the table(s) that contain the data you want to use.

3	Link the tables (if required) using the Visual Linking Expert.

Once you have done this, the RDC lists the tables you have selected and the fields available in each table under the Database Fields node in the Field Explorer on the left side of the Designer.

Then drag the fields you want onto your report and position them where you want them.

Database Files

This node lists standard PC data sources that reside locally. If your database isn’t listed, browse for your file using the Find Database File option.

More Data Sources

Use the More Data Sources node to select data sources that can be accessed through OLE DB and native drivers. This includes:

 	Microsoft Active Data sources (ADO, DAO, RDO)

 	Exchange folders

 	Data stored on the local file system

 	Mailbox Administration Files from Exchange

 	IIS and Proxy server log files

 	NT Event logs

 	Direct OLE DB connections

 	Outlook folders

 	Web IIS Log Files

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Active Data Sources

When you choose any of the Active Data data sources (ADO, DAO, RDO, or Data Definition Files), the RDC displays the Select Data Source dialog box with the appropriate tools enabled.

ADO

ActiveX Data Objects is the new data connection technology designed to provide a common interface for working with relational databases, mail messaging, event logs, and most any other form of data storage. ADO can be used to connect to any ODBC or OLE DB compliant data source when you design your report in the Report Designer Component.

The resulting ADO Recordset is not directly available from the Report Designer Component, but it can be replaced by alternative Recordset objects. For example, if your Visual Basic application allows users to make choices that can affect the set of data displayed by a report, simply create a new ADO Recordset at runtime, then pass it to the Report Designer Component using the SetDataSource method. The only restriction is that the fields in the new Recordset match the fields originally used to design the report. For more information on using the SetDataSource method, see SetDataSource method.

ADO is the most flexible option for data access. It provides a means of connecting to all kinds of data, including mail messaging, event logs, and Web server site data. In addition, it has been designed, ultimately, to replace DAO and RDO.

 	If you are creating new applications using Visual Basic, you should strongly consider ADO for your data connections.

 	If you are working with Visual InterDev for developing web sites, you have an additional advantage of being able to use ADO with Active Server Pages.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DAO

Data Access Objects (DAO) is designed primarily for use with local and ISAM (Indexed Sequential Access Method) data sources created through applications such as Microsoft Access, Microsoft FoxPro, and Borland dBASE. Although DAO can be used to connect to ODBC data sources, RDO and ADO provide more powerful options for such data. However, DAO is the oldest of the three technologies, giving it the advantage of being familiar to many Visual Basic programmers. As a result, DAO is also frequently found in existing applications, and applications created with older versions of Visual Basic.

If you are adding the Report Designer Component to a Visual Basic application that already uses DAO, or if you are connecting to a local data source such as an Access or dBASE file, you should consider using DAO to design your reports. Experienced Visual Basic programmers who are familiar with the DAO object model may also want to stick with a known technology. However, if you are working with ODBC or other remote data sources, RDO and ADO may be a better solution.

Once you design your report in the Report Designer Component, information about the connection to your DAO data source is stored with the report, and cannot be accessed directly. However, you can change the data displayed by a report by changing the data source at runtime using the SetDataSource method. A DAO Recordset object may be passed to the report through this method. Keep in mind, though, the Recordset must have fields identical to those in the original data source used at design time.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RDO

Remote Data Objects (RDO) is designed specifically for working with remote data sources. This includes ODBC and most common SQL database systems. In fact, RDO acts as an object-oriented wrapper around the ODBC API. The flexibility of ODBC is available to Visual Basic programmers through the simplicity of a COM based object model. Already a common choice for developers of client/server systems, RDO allows the execution of stored procedures and the processing of asynchronous operations, meaning your users can continue to work while your application processes a data query in the background.

The basic object used to manipulate data in RDO is a Resultset (specifically, the rdoResultset object). A new Resultset can be defined in your Visual Basic application and passed to the Report Designer Component at runtime using the SetDataSource method. The RDO data source used to initially create your report at design time, however, is not available for direct manipulation. Instead, information about the connection to the data source is stored inside the instance of the Report Designer Component that you add to your application. By creating a new Resultset at runtime, though, and passing the Resultset to the Report Designer Component, you can control the data in a report based on user requests and responses.

RDO provides a powerful connection to remote data sources through ODBC. If you are designing a client/ server application, or any application that needs to connect to a large database system such as Microsoft SQL Server, Oracle, or Sybase Adaptive Server, RDO can provide a strong solution. However, RDO limits your application to standard relational database systems. Other sources of data, such as e-mail and messaging servers, system logs, and Internet/intranet server logs are unavailable to RDO. Developers designing web-based applications using Visual InterDev would also be served better by ActiveX Data Objects (ADO).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Object (CDO)

If you develop applications that produce data that does not exist outside of the running application (applications monitoring system or network resources, for example), you can take advantage of the most powerful reporting features in the industry via the Crystal Data Object (CDO). Using CDO, the Active Data Driver, and the Report Design Component, you can create reports that are instant and up to date, without first having to dump the data to a separate database.

The Crystal Data Object is an ActiveX DLL that can be accessed from any Windows development environment that supports ActiveX. By creating a Rowset object, similar to a Recordset, and filling it with fields and data, you design a virtual database table that passes as an ActiveX data source to the Crystal Active Data Driver. Once the CDO Rowset has been created, it can be used just like any other active data source such as DAO or ADO.

CDO, like DAO and ADO, is based on the Component Object Model (COM). Any development environment that supports COM interfaces can dynamically generate a set of data for a report without relying on a database that exists at design time.

Note: The Crystal Data Object does not support Memo or BLOB fields.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Source Type Library

The Crystal Data Source Type Library, like Crystal Data Objects, provides a means for designing customized data sources that can be reported off of using the Active Data Driver. Crystal Data Source, however, unlike CDO, is a type library with an interface that can be implemented in a standard Visual Basic class. Once implemented, the Crystal Data Source interface allows you to manipulate data fully, much like you would manipulate a standard Recordset object in ADO or DAO.

Note: The Crystal Data Source type library is designed for Visual Basic 5.0 or later.

Keep in mind, though, once you add the Crystal Data Source interface to your class, you must implement all methods and properties exposed by the interface.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CDO vs. the Crystal Data Source Type Library

While CDO and the Crystal Data Source Type Library have some similarities, they have been designed as solutions to different data access problems:

 	If you need to implement a complete data source in your application that allows runtime movement through records and fields, or if you intend to implement your data source as a separate ActiveX component, consider using the Crystal Data Source Type Library.

 	If you need to create a quick and simple means of storing a large amount of data in a convenient package for reporting on, and the data will remain inside the same application as the reporting functionality, then use Crystal Data Objects.

Data Definition Files

A data definition file is a text file that contains information about the kind of data to place in a report instead of information about an actual data source.

 	At design time, you can build reports by pointing the Active Data Driver at a data definition file.

 	At runtime, point the Active Data Driver to an actual data source and the RDC builds your report from that new data.

While data definition files provide great flexibility in your reporting, and they are still supported in Version 8, they have been superseded with a more elegant technology, Unbound Fields.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Data Environments

Data Environments (introduced with VB 6) allow for interactive creation of hierarchical ADO Objects at design time, and easy access to data at run time. Through the Data Environment Designer you create Data Environment objects to connect with Data sources (Connection Objects), and access data from those sources (via Command Objects) at design time and run time.

You can use a data environment as a data source for reports you create with the Report Designer Component. If your project includes a data environment, the Report Designer Component will allow you to select the data environment as a data source at design time. Runtime reports make full use of the data exposed by a data environment by working with the standard connection, command, or recordset objects provided, much like working directly with an ADO object.

Microsoft Data Link (UDL) Files

The Report Designer Component now supports Microsoft Data Link (UDL) files.

Microsoft Data Link Files are comparable to File DSNs in ODBC. UDL files stores connection information to be used by the OLE DB layer. UDL's are available with OLE DB 2.0, which is installed by MDAC 2.x.

To create a UDL file:

1	Right-click on the Windows desktop, choose "New" from the popup menu and then choose "Microsoft Data Link". A new UDL file will appear on the desktop. By default, it will be called "New Microsoft Data Link.UDL". You can rename this file.

2	Double-click, or right-click, and choose Properties on this icon to configure the connection. Select the appropriate OLE DB provider in the Provider tab before entering information in the Connection tab. The template for the Connection tab changes based on the OLE DB provider used.

For more information on how to use UDLs, see the Microsoft Data Link help file, "msdasc.hlp".

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Templates using Unbound Fields

The RDC now enables you to create report templates based on unbound field objects. Then, using minimal code, you can bind those field objects to a data source (or one of several data sources) at runtime. The Report Engine uses the data type and the Name property of the unbound field object to match it with a data field in the recordset.

This technology replaces the need for data definition files. Data definition files are still supported in the Report Designer Component however. For additional information on using Unbound Fields, see For additional information on using Unbound Fields, see Using fields that bind to data sources only at runtime or the Unbound fields or Pro Athlete Salaries sample applications found in the C:\Program Files\Seagate Software\Crystal Reports\Samples\En\Code\Visual Basic folder.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Database Drivers

For the Report Designer Component to get data to display on the report, it uses a database driver. That driver may be a native driver such as Crystal’s native Microsoft Access driver, or it may be an ODBC or an OLEDB driver. Each of these drivers is a separate DLL.

These drivers architecturally work the same way: the Report Designer Component accesses the database for the data it needs.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Active Data Driver

The one driver that stands out is the Active Data driver (P2smon.dll (32-bit)). The difference with this driver is that it is not intended to be used to connect to your database. Instead, this driver works with recordsets.

Most database applications that you might create use recordsets to send data back and forth between the application and the database. With the Active Data driver, you would pass a populated recordset object, which is sitting in memory, to the Crystal Report Engine. The Report Engine then reads the recordset object to populate the report instead of reading the records in the database itself.

Passing the Recordset

For Crystal Reports to use the recordset in memory, you need to:

 	declare the recordset

 	run the query

 	extract the data.

This recordset can be of type ADO (Data Environment), DAO, RDO, or CDO. The syntax involved in passing a recordset to a report differs depending on the component being used. Refer to the Developer help file for more information.

Note: You must pass a recordset to the report. If you do not pass a recordset, the Report Designer Component will attempt to connect directly to your database.

 	If you have an unsecured database such as Microsoft Access, the report will work, but the driver is not being used the way it is intended to be used.

 	If the database is secured like a Microsoft SQL Server database, then an error message stating "Server not yet opened" will be displayed because a password was not supplied in order for the report to log on to the database.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetDataSource method

The SetDataSource method is designed for reports using the Active Data driver. The Method is used to provide information about a data source to the database driver associated with a Database object. For example, if the Crystal Active Data Driver has been used to design the report, this method can be used to provide an active data source for the report, such as a DAO, ADO, or RDO Recordset or a CDO Rowset.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


When RDC uses the Active Data Driver

There are three times that the RDC automatically uses the Crystal Active Data Driver:

 	When you use the Project button on the Data tab of the Report Expert to select your data source, the RDC will automatically use the Active Data Driver.

 	When you choose one of the Active Data options from the More Data Sources node in the Data Explorer, the RDC will also use the Active Data Driver.

 	When you use the new methods AddADOCommand or AddOLEDBSource, the RDC will automatically use the Active Data Driver. Both of these methods require you to supply an active ADO connection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Determining if the RDC is using the Crystal Active Data Driver

If you are having a problem with your data connection and you want to make certain that you are using the Crystal Active Data Driver:

1	Right-click the empty space beneath the field tree in the Field Explorer at the left of the RDC Designer.

2	Select Set Location from the shortcut menu when it appears.

3	When the Set Location dialog box appears, look at the Server Type at the bottom of the dialog. If the RDC is using the Active Data Driver, the server type will read Active Data and then give the active data type (For example, ADO, DAO, etc.).

Note: Alternatively, you can select Convert Database Driver from the shortcut report. When you make this selection, the driver currently in use will be grayed out yet visible.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Understanding the RDC Object Model

This section provides you with an understanding of the Report Designer Component (RDC) Object Model through a high-level overview of how a report is created. The overview is then related to the primary objects and collections contained in the RDC Object Model. More detailed information on a number of the objects, collections, and events is available at the end of the section.

Click the appropriate link to jump to that section:

 	Overview

 	The Application Object

 	The Report Object

 	The Database Object

 	Object Considerations

 	Collection Considerations

 	Event Considerations

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview

The Report Designer Component is a dual interface object model based on Component Object Model (COM) technology, a standard that allows applications and component objects to communicate with one another. Because the standard doesn’t specify how components are structured, but defines only how they communicate with one another other, the RDC can be used in any development environment that supports COM—such as Visual Basic, Visual C/C++, Visual InterDev, etc.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


A high level overview

The RDC is similar in operation to the Form designer in VB: it enables you to create instances of various classes visually.

 	You design a form by positioning controls where you want them to appear and then setting their properties.

 	Each of these controls is actually an instance of a class. A command button is an instance of one class. A text box is an instance of another.

 	You design a report in the same way, by positioning objects where you want them to appear and then setting their properties.

 	Each of the objects in your report is an instance of a class. A Section is an instance of one class. A text object is an instance of another.

A new report, by default contains five section objects: the Report Header (RH) section, the Page Header (PH) section, the Details section, the Report Footer (RF) section, and the Page Footer (PF) section. The sections are numbered in consecutive order from top to bottom. The top section is one; the bottom section is five. All of these sections together make up the Sections collection. The Sections collection is indexed with a one-based index.

Each of these sections has a single event: Format. The Format event is fired whenever a pass is made through the section as the report is being created. By trapping the format event for a section, you can manipulate the section or any of the objects you place in the section whenever the section is fired.

 	Manipulating the section involves actions such as setting its background color or its height.

 	Manipulating an object involves actions such as changing a font color in a field object based on a condition being true or changing the report title in response to user input.

You can do just about anything with the report at runtime, with a minimum of code, and all within the VB IDE.

At this very basic level:

 	You can place objects in your report.

 	You can manipulate the objects as needed in response to various events.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The next level

A report can have more than five sections. You can create these sections yourself if you need additional sections. The RDC will create some for you whenever you group or summarize data.

Sections are numbered consecutively as they are created.

 	The first new section created is section 6.

 	The second new section is 7, and so forth.

When sections are created, they are added to the Sections collection and indexed appropriately.

You can place a variety of Report Objects in the sections of your report.

 	If they are Field Objects, they could be one of many kinds of fields including database fields, formula fields, parameter fields, group name fields, or many others as well.

 	If they are Subreport objects, they can each be viewed as a separate object with its own set of properties. But each subreport is itself a report, and as a report it can contain virtually all of the same kinds of different objects that it’s parent report contains.

 	If they are Cross-tab objects, they too can be viewed as separate objects or as specialized reports that themselves contain a variety of different objects.

With Subreport objects and Cross-tab objects, you can change the properties of the objects themselves (Subreport Name, Cross-tab Name) and you can change the properties of the objects they contain as well.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Primary Objects and Collections

The following objects and collections are discussed in the section:

The Application object

The Report object

The Areas collection

The Sections collection

The ReportObjects collection

The FieldDefinitions collection

The Subreport Object

The Database Object

The DatabaseFieldDefinitions collection

The DatabaseTables collection

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Application object

The top level of the object model is the Application object. Since it is at the top, the RDC always expects it to be there, so there’s no need to reference it in your code (generally). There are some specific instances where you must reference it. For more information, see The Application Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Report object

Below the Application object is the Report object. The Report object contains many Collections and objects. For more information, see The Report Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Areas collection

The very top Collection in report is the Areas collection. By default it contains five Area objects. This is a special kind of collection that you may not use too often. We’ll talk about that when we discuss the next collection, Sections.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Sections collection

Every report, including a blank report, has Sections. The Sections are the bands in the report where you place the various report objects. By default, a new report, and thus the Sections collection for that report, contains five sections. Each of the five default sections resides in one of the five default areas—five sections:five areas. When you begin with a blank report, Areas and Sections are essentially the same. So there’s little need to reference an area unless you have a specific need to do so.

For example, you want to create several of one kind of section. In this example, you want to create several Details sections. In this case, the five areas:five sections relationship is broken. To refer to those Details sections as a unit, you can think of one Details Area now containing several Details sections. When you reference the area, you are referencing all of the sections in that area.

Thus, unless you have a special need, you can think of Sections as having Report for a parent. If you have the need, or if you want to be very specific, you can also think of Sections having Area for a parent. However you think of this part of the object model is fine. As long as you have five sections and five areas, you can access Sections through Areas, or you can go directly to Sections. Your code will work either way. For more information, see The Sections Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The ReportObjects collection

ReportObjects is a collection that can contain many things. With the exception of Areas and Sections, everything else in a report is a report object including Database field objects, Parameter field objects, and Text objects. Note that we used a lower case "r" and "o" for our spelling of "report object". The reason is there is no "ReportObject" in the ReportObjects collection. The ReportObjects collection is just a convenient way to think about these objects and it is useful in your code.

Now many of these objects that are considered to be members of ReportObjects are also members of more specific collections.

 	A SortField object, for example, is a member of the ReportObjects collection. It is also a member of the SortFields collection.

 	A FormulaFieldDefinition object, likewise, is a member of the FormulaFieldDefinitions collection.

You can access an object through the ReportObjects collection or through its namesake collection. This provides you with much flexibility in your coding. See The ReportObjects Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The FieldDefinitions collection

In the ReportObjects collection, many of the members have the word "field" in their names: GroupNameFieldDefinition, ParameterFieldDefinition. Objects that contain the word "field" are also a part of the FieldDefinitions collection. As was the case with ReportObjects, there is no such thing as a generic FieldDefinition in the FieldDefinitions collection. Instead there are specific kinds of fields including FormulaFieldDefinition, SpecialVarFieldDefinition, SummaryFieldDefinition, and others as well.

Following this up the hierarchy, we see that a ParameterFieldDefinition is a member of:

 	its namesake collection, ParameterFieldDefinitions

 	the FieldDefinitions collection

 	the ReportObjects collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Subreport Object

The Subreport Object is part of the ReportObjects collection. A subreport is a report within a report; it is a complete report with its own Areas, Sections, and ReportObjects. Once you access a Subreport object, you manipulate the objects in the subreport the same way you would with objects in the main report. For more information, see The Subreport Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Database Object

The Database object represents a data source for the report. But a data source doesn’t mean all the data available. It means only a subset of data that is useful for the report. That subset can be defined as collections of tables and, within each of those tables, collections of fields. When you think about a data source in this way, the data side of the RDC object model becomes clear. For more information, see The Database and Database Tables Objects.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The DatabaseTables collection

The Database object contains a DatabaseTables collection. This collection contains a number of DatabaseTable objects which comprise all the Tables which contain data used in the report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The DatabaseFieldDefinitions collection

Each DatabaseTable object contains a DatabaseFieldDefinitions collection which holds all of the fields from the table that are available for the report. Each of those fields is called a DatabaseFieldDefinition.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Object Considerations

The Application Object

Not all development environments support ActiveX designers. Visual C++ and Delphi, for example, are two environments where you can use the functionality of the RDC automation server but you can’t add the RDC directly to your projects. In these cases, you must access the Report Designer’s Report object by creating an instance of the Application object and then calling the OpenReport method as well.

In other situations, you may need to use separate report files in your application that were created or edited using Crystal Reports. An advantage of using such standalone report files is that through Crystal Reports, you can save report data with the report file, eliminating the need of maintaining a connection to a data source at runtime. In this case you will need to create an instance of the Application object and then call the OpenReport method as well.

The following code sample demonstrates the process of obtaining an Application object and opening a report file in Visual Basic:

Dim CRXApplication As CRAXDRT.Application

Dim CRXReport As CRAXDRT.Report

    Private Sub Form_Load()

       Set CRXApplication = CreateObject("CrystalRuntime.Application")

       Set CRXReport = CRXApplication.OpenReport("C:\Reports\Sales.rpt")

    End Sub

When this code finishes, rpt is a valid Report object and can be used just like any Report object you would obtain through the Report Designer Component.

Note: The sample call to CreateObject above uses a version independent Prog Id for the Report Designer Component. The correct Prog Id for this version of the Report Designer Component is CrystalRuntime.Application.8, but the version independent Prog Id should use the most recent version of the component installed on your system.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Report Object

Many existing ActiveX object models require declaring and creating a high level object, such as an Application object, before you can work directly with the data. The RDC, however, allows direct access to the Report object, giving you control over your reports with a small amount of Visual Basic code.

Assuming you have added the RDC to a Visual Basic application, and the (Name) property of that component is set to CrystalReport1, you can use code similar to the following to obtain a Report object representing that component:

Example:

Dim cr As CRAXDRT.Report

Set cr = New CrystalReport1

 	The first line declares cr as Report object from the CRAXDRT object library, the Report Designer Component’s object library.

 	The second line of code defines cr as a new instance of the report in the CrystalReport1 component in your application.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Field Object

All relational databases have two standard features: records and fields. Records contain the actual data, while fields define what type of data the records contain.

 	You can control the records through Recordset and Resultset objects exposed by ADO, RDO, and DAO.

 	You can manipulate the fields in the data source through these objects as well.

To manipulate the fields that appear in your report, however, you must either:

 	know the name of each database field you want to manipulate and reference each field directly, or

 	cycle through the fields in the ReportObjects collection to identify those fields that you want to manipulate.

For examples of how to use either of these methods, see Referencing objects in a report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Database and Database Tables Objects

All reports must connect to a data source to obtain data. The most commonly used data source is a relational database. The Report Designer Object Model, therefore, has provided objects, properties, and methods specific to working with databases.

The Database object is available directly from the Report object and represents the data source used by the report. This data source can be changed using the Database object’s SetDataSource method. In addition, the Database object provides the Tables property, a read-only property that gets the DatabaseTables collection of DatabaseTable objects. You have access to log on information (for password protected systems), database driver names, and database locations through a DatabaseTable object. Use code similar to the following in order to work with the Database and DatabaseTable objects:

Dim Report As New CrystalReport1

Dim tableName As String

Dim dbTable As CRAXDRT.DatabaseTable

Report.Database.Verify()’ Verifies a valid connection to the database

For Each dbTable In Report.Database.Tables

   tableName = dbTable.Name

Next

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Subreport Object

A SubreportObject object is another report inside the original report. Once you have obtained a SubreportObject, you can work with any aspect of it just as if it were a standard Report object.

You can obtain a SubreportObject through the ReportObjects collection. The following example shows you how to iterate through the sections of a report and change the background color of each subreport to magenta.

Dim Report As New CrystalReport1

Dim subReport As SubreportObject

Dim sect As Section

Dim rptObject As Object

For Each sect In Report.Sections

    For Each rptObject In sect.ReportObjects

        If rptObject.Kind = crSubreportObject Then

           Set subReport = rptObject

           subReport.BackColor = RGB(255, 0, 255)           Set subReport = Nothing

        End If

    Next

Next

Note: Currently, the Crystal Report Designer Component does not support subreports inside of subreports. The report iterations cannot go more than one subreport deep. However, you can have multiple subreports inside the main report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The CrossTabObject

A CrossTabObject object in the Report Designer represents a single cross-tab in your report. Cross-tabs are specialized subreports. Even if you design your primary report as a cross-tab, it is added to the report page as a separate object inside the report.

You can obtain CrossTabObject objects from a report much like you obtain subreports. Since a CrossTabObject is a report object like a field or a subreport, you can access it through the ReportObjects collection.

CrossTabObjects can be manipulated in the same way as other report objects. However, due to the complexity of this object, few properties and methods are exposed.

The following code searches for cross-tabs in a report and applies formatting features to make them stand out from the rest of the report.

Dim Report As New CrystalReport1

Dim xtObject As CrossTabObject

Dim sect As Section

Dim rptObject As Object

For Each sect In Report.Sections

             For Each rptObject In sect.ReportObjects

                 If rptObject.Kind = crCrossTabObject Then

                    Set xtObject = rptObject

                 xtObject.BorderColor = RGB(255, 0, 0)

                    xtObject.HasDropShadow = True

                    Set xtObject = Nothing

                 End If

             Next

Next

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Collection Considerations

The ReportObjects Collection

The ReportObjects collection of a report Section object contains all report objects in that section. Report objects may be Text objects, Fields, Subreport objects, or Cross-tabs. To be able to work with a particular report object, you must first obtain the object, and then determine what type of object it is.

Note:  If you want to work with all report objects in a section, consult iReportObject in the Object Browser for a list of properties that are common to all report objects.

Usually, report objects can be addressed directly in your code based on their Name property.

However, if you intend to work with several objects in a section, you need to refer to them through a Section object in the report. The following code locates the last object in the last section of the report and assigns a value to a String variable based on the type of object it is.

Dim Report As New CrystalReport1

Dim sect As Section

    Dim rptObject As Object

    Dim objKind As String

    Dim lastSectWithObject As Integer

lastSectWithObject = Report.Sections.CountSet sect = Report.Sections.Item(lastSectWithObject)

Do While sect.ReportObjects.Count <= 0

            lastSectWithObject = lastSectWithObject - 1

    Set sect = Report.Sections.Item(lastSectWithObject)

Loop

Set rptObject = sect.ReportObjects.Item(sect.ReportObjects.Count)

Select Case rptObject.Kind

            Case crBlobFieldObject

            objKind = "BLOB field object"

            Case crBoxObject

            objKind = "Box object"

            Case crCrossTabObject

            objKind = "CrossTab object"

            Case crFieldObject

            objKind = "Field object"

            Case crGraphObject

            objKind = "Graph object"

            Case crLineObject

            objKind = "Line object"

            Case crOleObject

            objKind = "OLE object"

            Case crSubreportObject

            objKind = "Subreport object"

            Case crTextObject

            objKind = "Text object"

            Case Else

            objKind = "Unknown object"

End Select

Note: Instead of using the Item property as shown, you can reference a report object directly using its index, for example, ReportOptions(1). You can also reference it directly using its name property by including the report object name in quotes, for example, sect.ReportObjects("Field5") instead of sect.ReportObjects(1).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Sections Collection

All report objects, such as Fields and Text objects, are contained within Sections. Often, you can obtain these directly by referring to the name property of an object in your code.

Note: There may be times, however, when you need to obtain an object through the report section it is in. At other times, you may have a need to make changes to the section itself.

Every report contains a collection of its sections, stored in the Sections property of the report object. You can access individual sections through this collection. For example, the code below sets the height of the first section of the report (the Report Header) to half an inch (720 twips) and suppresses the second section of the report (the Page Header) so that it will not appear.

Dim Report As New CrystalReport1

Report.Sections.Item(1).Height = 720

Report.Sections.Item(2).Suppress = True

For information on how to obtain and work with other objects within a Section object, such as fields and text objects, refer to The ReportObjects collection.

Each section in a report is itself a collection. The collection contains all of the report objects in that section. When designing your application, be aware that when a section is being formatted, all objects in that section are also being formatted. Also, all other sections and objects outside of the current section are not being formatted. This information can affect how data is displayed in various sections of the report, depending on your code.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Event Considerations

The RDC directly supports four events:

 	AfterFormatPage

 	BeforeFormatPage

 	FieldMapping

 	NoData.

The RDC supports the Format event for the Section object as well. These new events are discussed in detail in the Developer’s online help.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Format event for the Section object

The Crystal Report Designer Component provides a Format event for every section of your report. This allows you to control report formatting and output dynamically at runtime. For example, you can apply conditional formatting during the Format event, based on conditions that exist only at runtime.

The Format event is a standard Visual Basic event that you can program by displaying the Code View of the Report Designer Component. Assuming the Report Designer has been named CrystalReport1 in your Visual Basic project:

1	In the Visual Basic Project window, select the CrystalReport1 designer from the Designers folder.

2	Click the View Code button in the toolbar at the top of the Project window. A Code window will appear for the CrystalReport1 designer component.

3	In the object drop-down list box at the top left of the Code window, select a Section object that you want to apply code to. Notice that Section objects are numbered in the order that they appear on your report, from the top of the Report Design window to the bottom. For instance, if you select the Section1 object, your code will apply to the Report Header section of your report. These Section objects are labeled for you at the top of each section in the Report Designer window.

Notice that when you select a Section object, the Format event is automatically selected for you in the event drop-down list box at the top right of the Code window. Format is the only event available to the Section object.

When writing code for the Format event, keep in mind that not all properties and methods for all objects are available during the Format event. Many properties are available on a read-only basis. If you are not sure about a property or method, refer to the specific property or method name in the Object Browser or the Report Designer Object Model reference section of the Developer help file.

The Format event receives a single argument from the Report Designer Component. The pFormattingInfo argument is an object of type FormattingInfo. The FormattingInfo object has only three properties:

 	IsEndOfGroup - This property is true if the section being formatted is a Group Footer.

 	IsRepeatedGroupHeader - This property is true if the section being formatted is a repeated Group Header. Repeated Group Headers appear when a group extends to two or more pages, and the group has been formatted to repeat information that appears in the Group Header on the second, third, etc. pages. This property is only true if the Group Header is the second, third, etc. instance of the Group Header. It is false for the original first instance of the Group Header.

 	IsStartOfGroup - This property is true if the section being formatted is a Group Header.

Note: When designing your application, be aware that when a section is being formatted, all objects in that section are also being formatted. Also, all other sections and objects outside of the current section are not being formatted. This information can affect how data is displayed in various sections of the report, depending on your code.

Note: If you are using the Format event to calculate values and you need to carry that value across sections (as in a running total, for example), you will need to use a Report Variable to store your ongoing total. Report Variables are new to version 8. For further information on Report Variables, please see Report Variables.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Visual Basic Initialize and Terminate events

In addition to the report-specific events, the Report object can also produce the standard Visual Basic Initialize and Terminate events.

The Initialize event is fired when you first reference the Report object at runtime. For example, your application may contain a global variable that represents the Report object of the Report Designer that you added to your application at design time:

Dim Report As New CrystalReport1

In this case, declaring and setting the Report variable fires the Initialize event. The Terminate event will be fired when this variable is set to Nothing:

Set Report = Nothing

The Initialize event and the Terminate event are fired only once for each Report instance. With that in mind, you can make many changes to your report within the event procedure code for each of these events:

Private Sub Report_Initialize()

   ’Add report initialization code here

End Sub

Private Sub Report_Terminate()

   ’Add report clean up code here

End Sub

 	Use the Initialize event to make broad changes that affect the entire report. For instance, you could assign a new data source using the SetDataSource method.

 	Use the Terminate event to clean-up of any variables or objects that you created during the Initialize event. If, for instance, you created a new ADO Recordset object in the Initialize event, you can use the Terminate event to set this Recordset object equal to Nothing, freeing up system memory and resources.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RDC Programming

This section provides solutions to a number of common runtime challenges. Most of these challenges involve accessing an object and then changing the properties. The section first discusses special considerations when programming with the Report Designer Component (RDC); it then presents the two general methods to access an object in a report or subreport. The examples assume that you have used one of these methods to locate the object of interest in order to concentrate on the special considerations that you may have with each of the various procedures.

Click the appropriate link to jump to that section:

 	Special Considerations

 	Two Methods to Access an Object in a Report or Subreport

 	Runtime Examples

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Special Considerations

Object naming considerations

If your project includes other libraries that contain objects with names identical to those found in the Crystal Report Engine Object Library, you will encounter conflicts unless you reference the objects using a prefix that identifies their source. For example, if you have included the DAO Library with the RDC runtime object library in your project, you will find that both libraries include a Database Object. In order to avoid conflicts, you must prefix the objects as follows:

CRAXDRT.Database

for the object from the RDC runtime Object Library, or

DAO.Database

for the object from the DAO Library.

Scope considerations

When you specify a data source using code, it is important you place the code in the appropriate location in your project.Otherwise, you will face "no data" or runtime error situations because the report may be searching for data that has gone out of scope.

By default, the program does not read data into the report until you actually run the report (print it, preview it, etc.). Anything that terminates the connection to the data source before this time will cause out of scope problems.

Typical out-of-scope problems include:

 	Declaring a local object variable for the recordset or resultset in the Form_Load event procedure. While this may seem appropriate, the variable, and thus the data it references, will go out of scope as soon as the form stops loading.

 	Similarly, declaring a local object variable in the Report_Initialize event procedure will go out of scope because the recordset is discarded at the end of the procedure. That procedure ends before any records are read from the recordset.

Both problems can be corrected by declaring the variable for the recordset at the module level.

 	A third problem can occur when you declare a global variable for the report and try to populate it with a recordset that only has procedural scope. The following code provides a good example of this:

Dim CRXReport As New CrystalReport1

Private Sub Form1_Load()

    Call SetData

      CRViewer1.ReportSource = CRXReport

      CRViewer1.ViewReport

    End Sub

Private Sub SetData()

    Dim rs As New ADOR.Recordset

        rs.Open "Select * From Customer", "Xtreme Sample Database"

      CRXReport.Database.SetDataSource rs, 3, 1

    End Sub

In this example, although the CRXReport object is global (for the Form), the rs object exists only for the life of the SetData procedure. Even though it is assigned to the Report object before SetData finishes, the object, and the data that rs represents goes out of scope and is invalid for the Load event. Thus, the code will fail.

This problem can be solved using the ReadRecords method. ReadRecords forces the report to read the records into the report so that they are internal to the Report object itself rather than remaining as a separate Recordset object referenced by the report.

Private Sub SetData()

   Dim rs As New ADOR.Recordset

      rs.Open "Select * From Customer", "Xtreme Sample Database"

     CRXReport.Database.SetDataSource rs, 3, 1

     CRXReport.ReadRecords

   End Sub

In this case, the records are read into the report prior to the end of the procedure. Thus, when the procedure ends, the recordset object may be discarded but the records are still available for use.

Index considerations

The various collections in the RDC object model are all one-based, that is, the first member of a collection has index number 1, the second member has index number 2, and so forth. Collection members are indexed consecutively in the order that they are created.

Dual Interface considerations

The Report Design Component provides dual interfaces. As a result, development environments such as Visual Basic and Visual C++ can bind with vTable interfaces at compile time, and less robust environments, VBA, ASP, for example, can use the IDispatch interface for runtime-only binding.

It is important that you use the more efficient vTable interface if it is supported by your development environment.

 	When you use vTable binding, you have "early binding" which means the VB compiler can identify syntax errors at compile time when they’re easier to identify and fix than when they appear only at runtime.

 	It enables the VB IDE to speed your coding process by providing hints as you code through its "Auto List Members" and "Auto Quick Info" capabilities.

When you work with Visual Basic, always use the more efficient vTable interface as long as you Dim your object variables using specific class names instead of using the more generic "Object" type.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Two Methods to Access an Object in a Report or Subreport

Referencing objects in a report

Before you work with a report object, you have to reference it (open it). You can reference a report object either explicitly or implicitly:

 	Referencing the object Explicitly is the easiest and quickest method for referencing a report object. When you use this method, your code can reference the report and its objects directly.

 	Referencing a report object Implicitly is a more generic approach. This approach allows your code to reference the report and its objects indirectly.

 	You can access objects in a report either explicitly or implicitly.

Explicit reference - an object in the report

Assume that in your report you have a field with the Name property "OrderID". Since you know the field name, you can use code similar to this to reference the OrderID field directly.

Dim CRXReport As New CrystalReport1

Dim CRXReportField As FieldObject

Set CRXReportField = CRXReport.OrderID

Note: Now that you have the OrderID field, you can put your code here to work with the properties of that field.

Implicit reference - cycling through the sections

If you are planning to work with a number of different kinds of report objects, you can cycle through the sections, test each of the report objects for kind, and manipulate them as you wish. You can do that using code similar to this:

    Dim CRXReport As New CrystalReport1

    Dim CRXTables As CRAXDRT.DatabaseTables

    Dim CRXTable As CRAXDRT.DatabaseTable

    Dim CRXSections As CRAXDRT.Sections

    Dim CRXSection As CRAXDRT.Section

    Dim CRXSubreportObj As CRAXDRT.SubreportObject

    Dim CRXReportObjects As CRAXDRT.ReportObjects

    Dim CRXReportObject As Object

Note: You put this code in the Form_Load event of the startup form which contains the Report Viewer.

 Start by getting the sections from the Main report.

Set CRXSections = CRXReport.Sections

You begin cycling through each section in the main report.

For Each CRXSection In CRXSections

In each section, you get all the objects in the section.

Set CRXReportObjects = CRXSection.ReportObjects

You cycle through the objects.

For Each CRXReportObject In CRXReportObjects

You test the objects to see if they’re subreports.

If CRXReportObject.Kind = crSubreportObject Then

When you find a subreport, you get a hold of it.

Set CRXSubreportObj = CRXReportObject

Before you work with an object in a report, you have to reference it (open it).

Implicit reference - through a collection

If you are planning to work with a specific kind of report object, you can access the object by referencing the collection that contains that object. You reference a collection in a report through the appropriate Report property. Those properties, and the collections they get, are as follow:

Property
Gets
Areas
Areas collection (Areas)
Database.DatabaseTables
Database Tables collection
FormulaFields
Formula Fields collection (FormulaFieldDefinitions)
GroupNameFields
Group Name Fields collection (GroupNameFieldDefinitions)
RunningTotalFields
Running Total Fields collection (RunningTotalFieldDefinitions)
GroupSortFields
Group Sort Fields collection (SortFields)
ParameterFields
Parameter Fields collection (ParameterFieldDefinitions)
RecordSortFields
Record Sort Fields collection (SortFields)
Sections
Section collection (Sections)
SQLExpressionFields
SQL Expression Fields collection (SQLExpressionFieldDefinitions)
SummaryFields
Summary Fields collection (SummaryFieldDefinitions)

Once you have the collection, you can cycle through the collection to locate the appropriate object you want. The following example shows you how to access the FormulaFieldDefinitions collection:

You can put this code in the General Declarations.

Dim CRXReport As New CrystalReport1

Dim CRXFormulaField As CRAXDRT.FormulaFieldDefinition

You can put this code in the Form_Load event procedure.

Private Sub Form_Load()

This code gets the collection.

Set CRXFormulaFields = CRXReport.FormulaFields

’You can put your code here to cycle through the collection to get the specific object you want

Finally you can view the report.

Crviewer1.ReportSource = CRXReport

Crviewer1.ViewReport

End Sub

Referencing objects in a subreport

Before you work with a subreport, you have to reference it (open it). Similar to referencing objects in a report, you can do this either explicitly or implicitly.

Explicit reference - the subreport itself

Assume that in your report you have a subreport with the Name property "Orders". Since you know the subreport name, you can use code similar to this to reference that subreport directly:

Dim CRXReport As New CrystalReport1

Dim CRXSubReport As SubreportObject

Set CRXSubReport = CRXReport.Orders

Note: Now that you have the subreport, you can add code to manipulate the subreport.

Explicit reference - an object in the subreport

Assume that in your report you have a subreport with the Name property "Orders" and that, in that subreport, you have a field with the Name property "OrderID". Since you know the subreport and field names, you can use code similar to this to reference the OrderID field directly:

Dim CRXReport As New CrystalReport1

Dim CRXSubReport As SubreportObject

Set CRXSubReport = CRXReport.Subreport1

Dim CRXSubReportField As FieldObject

Set CRXSubReportField = CRXReport.Orders_OrderID

Now that you have the OrderID field, you can add code to work with the properties of that field.

Please note the special way you reference a field in a subreport by name. You must use:

 	the name of the subreport

 	an underscore

 	the name of the field.

The result, in this example, Orders_OrderID, appears to be a field in myReport with the name Orders_OrderID. It is actually a field in the Orders subreport; the program uses dynamic type info to generate these names at runtime. You can find the names by looking at the Project in the Object Browser.

Implicit reference

Though this approach is more complex, it is not bound to a particular report, and the code can be reused with minor modifications for other reports that contain subreports. You can use code similar to the following to access any and all subreport(s) in a particular report.

You can declare the Variables in the General Declarations section of a form.

Dim CRXReport As New CrystalReport1

Dim CRXTables As CRAXDRT.DatabaseTables

Dim CRXTable As CRAXDRT.DatabaseTable

Dim CRXSections As CRAXDRT.Sections

Dim CRXSection As CRAXDRT.Section

Dim CRXSubreportObj As CRAXDRT.SubreportObject

Dim CRXReportObjects As CRAXDRT.ReportObjects

Dim CRXSubreport As CRAXDRT.Report

Dim CRXReportObject As Object

You put this code in the Form_Load event of the startup form which contains the Report Viewer.

You start by getting the sections from the Main report.

Set CRXSections = CRXReport.Sections

You begin by cycling through each section in the main report.

For Each CRXSection In CRXSections

In each section, you get all the objects in the section.

Set CRXReportObjects = CRXSection.ReportObjects

You cycle through the objects.

For Each CRXReportObject In CRXReportObjects

You test the objects to see if they’re subreports.

If CRXReportObject.Kind = crSubreportObject Then

When you find a subreport, you get a hold of it.

Set CRXSubreportObj = CRXReportObject

Finally, you open the subreport and treat it as you would any other report.

Set CRXSubreport = CRXSubreportObj.OpenSubreport

Note: This is where you put the code for manipulating the subreport.

End If

Next CRXReportObject

Next CRXSection

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Runtime Examples

The following topics are discussed in this section:

Working with Cross-Tabs

Working with Data sources

Working with Formatting

Working with Formulas/Selection Formulas

Working with Grouping

Working with parameter fields

Working with OLE objects

Working with Sorting

Working with Summary Fields

Working with Text Objects

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Cross-Tabs

Modifying a cross-tab at runtime

A CrossTabObject object in the Report Designer represents a single cross-tab in your report. Cross-tabs are specialized subreports. Even if you design your primary report as a cross-tab, it is added to the report page as a separate object inside the report.

CrossTabObject objects can be obtained from a report much like subreports. A CrossTabObject is implemented as a single report object accessible through the ReportObjects collection.

The following code searches for cross-tabs in a report and applies formatting features to make them stand out from the rest of the report.

Dim CRXReport As New CrystalReport1

Dim CRXXtObject As CRAXDRT.CrossTabObject

Dim CRXSection As Section

Dim CRXReportObject As Object

For Each CRXSection In Report.Sections

    For Each CRXReportObject In sect.ReportObjects

        If CRXReportObject.Kind = crCrosstabObject Then

            Set CRXXtObject = CRXReportObject

            CRXXtObject.BorderColor = RGB(255, 0, 0)

            CRXXtObject.HasDropShadow = True

            Set CRXXtObject = Nothing

               End If

            Next

Next

Although cross-tabs are much like subreports, because of their specialized handling of data, there are fewer properties available to the CrossTabObject object than to the SubreportObject object. Before trying to use a property with a cross-tab in your report, verify that the property is available to the CrossTabObject object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Data sources

Changing an ADO data source location - new methods

In Crystal Reports 8, there are two new methods to add ADO data sources to a report:

 	AddADOCommand takes as parameters an active ADO connection and an ADO command object. In this example, a new connection is created to a database, and the resulting recordset is assigned at runtime to the report.

 	AddOLEDBSource takes as parameters the name of an active ADO connection and the name of a table that can be accessed through that connection.

In this example, a connection set up through the VB Data Environment is used as a data source. Both methods can be used with either the VB Data Environment or another data source created at runtime.

Option Explicit

Dim CRXReport As New CrystalReport1

The ADO connection to the local database.

Dim cnn1 As ADODB.Connection

Dim datcmd1 As ADODB.Command

Demonstrate the use of AddADOCommand by opening an ADO data command and adding the data source to the report.

Private Sub cmdADO_Click()

    Dim strCnn As String

Open the data connection.

    Set cnn1 = New ADODB.Connection

    strCnn = "Provider=MSDASQL;Persist Security Info=False;Data Source=Xtreme Sample Database;Mode=Read"

    cnn1.Open strCnn

Create a new instance of an ADO command object.

    Set datcmd1 = New ADODB.Command

    Set datcmd1.ActiveConnection = cnn1

    datcmd1.CommandText = "Customer"

    datcmd1.CommandType = adCmdTable

Add the datasource to the report.

    CRXReport.Database.AddADOCommand cnn1, datcmd1

End Sub

Adding a data source and a field using AddOLEDBSource

This section demonstrates the use of AddOLEDBSource. One line of code:

 	Opens an ADO data source,

 	Adds the data source to the report, and then

 	Adds a field to the report that uses that data source.

In this example, we are using an OLEDB source created in a VB Data Environment.

CRXReport.Database.AddOLEDBSource

DataEnvironment1.Connection1,"Customer"

Setting the data source for a subreport

This section describes how to change the database location for different types of datasources

 	Native

 	ODBC

 	Active Data.

You change the database location (change the data source) for a subreport in much the same way as you set the database location for the main report. Before you can change the database location for a subreport, you first need to open the subreport. For more information, see Referencing objects in a subreport.

Once you have opened the subreport you can change the database location. The following examples show you how to do that for a variety of different types of data sources.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Native connection to PC database

If the datasource of the subreport is a PC-type database (for example, MS Access), and the report is connecting natively (P2BDAO.DLL), then you can use code similar to the following:

1	Get the Tables collection for the subreport.

Set CRXTables = CRXSubreport.Database.Tables

2	Get the first table from the Tables collection.

Set CRXTable = CRXTables.Item(1)

3	Finally, set the location of the .mdb file.

CRXTable.Location = "C:\My_Application\My_DB.mdb"

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Native connection to SQL database

If the datasource of the subreport is of an SQL-type (for example, MS SQL Server), and the report is connecting natively (P2SSQL.DLL), then you can use code similar to the following:

1	Get the Tables collection for the subreport.

Set CRXTables = CRXSubreport.Database.Tables

2	Get the first table from the Tables collection.

Set CRXTable = CRXTables.Item(1)

3	Finally, set the location of the .mdb file.

CRXTable.SetLogOnInfo <servername>, <databasename>, <userid>, <password>

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ODBC connection to a PC or SQL database

 If the datasource of the subreport is a PC-type (for example, MS Access) or SQL-type (for example, MS SQL Server), and the report is connecting via ODBC (P2SODBC.DLL), you can use code similar to the following:

1	Get the Tables collection for the subreport.

Set CRXTables = CRXSubreport.Database.Tables

2	Get the first table from the Tables collection.

Set CRXTable = CRXTables.Item(1)

3	Finally, set the location of the .mdb file.

CRXTable.SetLogOnInfo <ODBC_DSN>, <databasename>, <userid>, <password>

Active data connection to a PC or SQL database

If the datasource of the subreport is an active data source (ex. DAO, RDO, ADO, CDO, etc.), and the report is connecting using the active data driver (P2SMON.DLL), then you can use code similar to the following:

1	Get the Tables collection for the subreport.

Set CRXTables = CRXSubreport.Database.Tables

2	Get the first table from the Tables collection.

Set CRXTable = CRXTables.Item(1)

3	Finally, set the location of the.mdb file.

CRXTable.SetDataSource rs, 3

There are many ways that you can access a subreport, and change the database location for a subreport. The above examples are simplified and generic so that they can be used and altered to accommodate an application with any report.

Connecting to OLEDB providers

Each OLEDB provider requires a specific connection string. The following sample connection strings are for use in the "Connection" input box of the "ADO and OLE DB" option on the "Select Data Source" dialog box for the Active Data report expert:

Microsoft Jet 3.51 OLE DB Provider

Provider=Microsoft.Jet.OLEDB.3.51;Data Source=c:\Access\Northwind.mdb

Note: At this time, it is not possible to use secured Access databases in the Crystal Report expert.

 	This OLE DB provider appears to only work with 32-bit Access databases.

 	Notice that the database table and query names do not appear in the drop-down boxes. This has been tracked. The option is to use the SQL textbox instead.

Microsoft OLEDB Provider for SQL Server

Syntax:

Provider=SQLOLEDB;SERVER=SName;DATABASE=DBName; UID=MyID; PWD=MyPWD

Example:

Provider=SQLOLEDB;Server=TechTest;Database=Pubs;UID=Admin;PWD=sa

Microsoft OLEDB Provider for ODBC Drivers

Syntax:

Provider=MSDASQL;DSN=MyDSN;UID=MyUID;PWD=MyPassword

Examples:

For secured Data Sources:

Provider=MSDASQL;DSN=Xtreme Sample Database;UID=Admin;PWD=Password

For non-secured data sources type the DSN:

Xtreme Sample Database

Note: If it is OLE DB that is being used as the provider for ODBC, select the first option of the "Select Data Source" dialog box ("ODBC(ADO)") which uses that specific provider by default.

Microsoft OLEDB Provider for Oracle

Syntax:

Provider=MSDAORA;Password=;User ID=;Data Source=

Example:

Provider=MSDAORA;Password=MyPassword;User ID=Admin;Data Source=MyOracleServer

Note: It will probably be necessary to re-type the UserID and Password in the corresponding text boxes of the Select Recordset dialog box.

Connecting to a secure Access session

If your reports connect to secure Microsoft Access sessions, you must provide session information at runtime using the SetSessionInfo method of the DatabaseTable object. This method accepts a user ID and password that are passed to the Access session to provide a connection to the database.

Session information must be added to your code using the SetSessionInfo method, even if you specified session information at design time. Session information specified at design time is not stored with the Report Designer Component.

Assuming all tables in your report are from the same secured Access database, you can use code similar to the following to set the Access session information:

Dim CRXReport As New CrystalReport1

Dim CRXTable as CRAXDRT.DatabaseTable

For Each CRXTable In CRXReport.Database.Tables

    CRXTable.SetSessionInfo "user", "password"

Next

Working with secure data in reports

If your report connects to a secure data source that requires log on information, you will not be able to log off of the data source until the Report object has been closed or has gone out of scope. Keep in mind that if you assign the Report object to the ReportSource property of the CRViewer object in the Crystal Reports Report Viewer, the Report object cannot be closed until you assign a new value to the Report Viewer or close the CRViewer object. Thus, you will not be able to log off of a secure data source until the report is no longer displayed in the Report Viewer.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Formatting

Using Report Variables

Certain events, like the OnSectionFormat event, may get fired more than once in a section. For example, a Details section may fire multiple times for a given record if the program is performing "Keep Section Together" calculations for the report. When you are using VB variables that are supposed to increment once for each record (as when you are calculating a running total), you can have problems maintaining state with these multiple firings.

To prevent these problems, the RDC now enables you to declare Report Variables. Report variables are Crystal variables that you can use in your VB code. Report Variables "understand" what’s going on in the report and they increment appropriately. This enables you to do more of your coding than ever in VB and still get the results you expect.

There are three methods you use with report variables.

AddReportVariable

You use AddReportVariable to declare a Report Variable. The following code declares four Report Variables:

 	CurrencyVal of the type currency

 	LongVal of the type number

 	DoubleVal of the type number

 	StringVal of the type string

AddReportVariable crRVCurrency, "CurrencyVal"

AddReportVariable crRVNumber, "LongVal"

AddReportVariable crRVNumber, "DoubleVal"

AddReportVariable crRVString, "StringVal"

GetReportVariableValue

You use GetReportVariableValue to reference the value in a Report Variable. The following code references the value in the Report Variable, CurrencyVal.

CurVal = GetReportVariableValue("CurrencyVal")

SetReportVariableValue

You use SetReportVariableValue to increment a Report Variable. The following code sets the value of the Report Variable CurrencyVal to the value of the expression "CDbl(CurVal) + CDbl(FieldCurrency.Value)".

SetReportVariableValue "CurrencyVal", CDbl(CurVal) + CDbl(FieldCurrency.Value)

Note that you can only use Report Variables at runtime and that you must use double quotes every time you reference such a variable.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Formatting a section or report object conditionally

You can now do conditional formatting using VB code. Crystal Reports has allowed this in the past with its own formula language but now you can do it in VB code as well.

This Format event is fired each time this section is formatted, so you can get the values of the object and perform a variety of formatting functions.

This first example changes the backcolor of the section itself if the value of the selected field is less than 50000.

Private Sub Section6_Format(ByVal pFormattingInfo As Object)

If Field9.Value < 50000 Then

        Section6.BackColor = vbRed

    Else

        Section6.BackColor = vbWhite

    End If

End Sub

The second example changes the color of the text in the selected field if the value of that field is less than 50000.

Private Sub Section6_Format(ByVal pFormattingInfo As Object)

If Field9.Value < 50000 Then

        Field9.TextColor = vbRed

    Else

        Field9.TextColor = vbGreen

    End If

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Formulas/Selection Formulas

Passing a Selection Formula at Runtime

When you pass the selection formula to Crystal Reports, you use the RecordSelectionFormula property of the Report object.

Note: Formulas must conform to Crystal Reports’ formula syntax.(i.e. strings embedded in single quotes while numbers not, etc.). For Crystal Reports to parse a formula it receives from the application (Visual Basic in this case), the formula must be identical to a formula that you would enter directly into the report designer. You can use the MsgBox function in Visual Basic to verify that the formula string being sent from VB is in a format that can be used by Crystal Reports.

Two ways you can use the RecordSelectionFormula property of the Report object are:

 	Hardcoding: you can copy your code from your report and paste it into the code.

 	Using a variable: you can append the value of a variable onto your code when calling the RecordSelectionFormula property.

CRXReport.RecordSelectionFormula = "{Customer.Region} = ’CA’"

Note: Any dates passed to Crystal Reports must be in Crystal Reports Date format, Date(yyyy,mm,dd).

Passing a Formula at runtime

When passing a value to Crystal Reports, you use the.Text property of the FormulaFieldDefinition object.

First, you create your formula using the Crystal Reports formula language.

 	If you are giving it a string value, you must place a string value in it. This will force the program to treat the formula as a string.

 	A single space inside double quotes is a good idea, since this will not print if left unchanged—yet it holds the string type for when you change the actual value later from VB.

Place the new formula on your report where you would like to display the passed value.

If you will be sending a numeric value or date, again place an appropriate value in the formula in order to establish the data type of the formula.

 	To pass a numeric value to a formula, place 0 in the formula when you create the formula in Crystal Reports.

 	To pass a date value to a formula, place the Today function in the formula.

The following code shows how you can send a title to your report from your VB application. As instructed above, a formula is inserted at the top of the report, and is named Title. It presently contains a space inside quotes, as in " ".

Sub Command1_Click ()

'if we hard-code the title

CRXReport.FormulaFields.Item(1).text = "'Report Title'"

'If we use the value of the Textbox

Text1.Text = "This is a Title"

CRXReport.FormulaFields.Item(1).text = chr(34) & Text1.text & chr(34)

End Sub

The following code changes the value of a numeric formula at runtime.

Sub Command1_Click ()

'if we hard-code the numeric value

CRXReport.FormulaFields.Item(1).text = "9"

'If we use the value of a variable

x = 65

CRXReport.FormulaFields.Item(1).text = x

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Changing a subreport’s record selection formula at runtime

Changing the record selection formula for a subreport is similar to changing it for the main report. Before you can change the record selection formula for a subreport, you first must open the subreport. Please refer to Referencing objects in a subreport for examples of different ways you can access a subreport.

Once you have opened the subreport object, you can use code similar to this to change its record selection formula.

CRXSubreport.RecordSelectionFormula = "{Customer.Last Year's Sales} > 100000"

The subreport acts like any report, where any object, property, and method that is accessible by the Report object is the same for a subreport. The only limitation is that subreports cannot be previewed, printed, or exported as an individual report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Referencing a report formula using the formula name

The following code sample shows how to reference a report formula at runtime using the formula name instead of referencing the formula by index.

You can put this code in the General Declarations.

Dim CRXReport As New CrystalReport1

Dim CRXFormulaFields As CRAXDRT.FormulaFieldDefinitions

Dim CRXFormulaField As CRAXDRT.FormulaFieldDefinition

You can put this code in the Form_Load event procedure.

Private Sub Form_Load()

Set CRXFormulaFields = CRXReport.FormulaFields

Now you can cycle through the formula fields collection.

For Each CRXFormulaField In CRXFormulaFields

Here you find the formula you require by specifying its name. Note the format that the .Name property returns.

If CRXFormulaField.Name = "{@formula}" Then

Now you set the formula text.

CRXFormulaField.Text = "{Customer.Name}"

End If

Next

Finally, you can view the report.

Crviewer1.ReportSource = CRXReport

Crviewer1.ViewReport

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Grouping

Changing the existing group's condition field

For this scenario, assume that a report has been created which is currently grouped on the City field (For example, {Customer.City}). To change the condition field for the existing field at runtime, you can use the following code.

Note: This code assumes that you know which field you want to change and that there is only one group in the report.

You can place this code in the General Declarations section.

Dim CRXReport As New CrystalReport1 'The existing report (ActiveX Designer)

Dim CRXDBField As CRAXDRT.DatabaseFieldDefinition

You can put this code in the FORM_LOAD event procedure.

Private Sub Form_Load()

Currently the group is based on the CITY field, but you want to change it to the REGION field. This code accesses the first table to get the 12th field which is the REGION field.

set CRXDBField = CRXReport.Database.Tables.Item(1).Fields.Item(12)

Now you can set the new condition field for the existing group. Since you know that there is only one group in the report, you can reference it by its name "GH".

CRXReport.Areas.Item("GH").GroupConditionField = CRXDBField

Finally, display the report.

CRViewer1.ReportSource = CRXReport

CRViewer1.ViewReport

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding a new group to the report

For this scenario, assume that a report has been created and it does not contain any groups. To add a new group to the report at runtime, you can use code similar to the following:

Note: Please note that using this method will not display the group name on the report.

You can place this code in the General Declarations section.

Dim CRXReport As New CrystalReport1 'The existing report (ActiveX Designer)

Dim CRXDBField As CRAXDRT.DatabaseFieldDefinition

You can place this code in the FORM_LOAD event procedure.

Private Sub Form_Load()

For this example, you want to add a group that is based on the REGION field. This code accesses the first table to get the 12th field, which is the REGION field.

set CRXDBField = CRXReport.Database.Tables.Item(1).Fields.Item(12)

Now you can add the new group to the report. Please note that:

 	0 is the GroupNumber in case you add more than one group

 	CRXDBField is the ConditionField

 	crGCAnyValue is the condition on which the group changes

 	crAscendingOrder is the SortDirection

CRXReport.AddGroup 0, CRXDBField, crGCAnyValue, crAscendingOrder

Finally, display the report.

CRViewer1.ReportSource = CRXReport

CRViewer1.ViewReport

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding a group sort field

This scenario requires a report that already contains a group which also must contain a summary field.

A Group Sort Field can only exist if the group contains a summary field, because that summary field is what the Sort is based on. In this example, the report is grouped on {Customer.Region} and the summary field is the "SUM of Customer.Last Year's Sales (Currency)".

To add a group sort field you can use code similar to the following:

1	Place this code in the General Declarations section.

Dim CRXReport As New CrystalReport1 'The existing report (ActiveX Designer)

Dim CRXSortFields As CRAXDRT.SortFields

Dim CRXSummaryField As CRAXDRT.SummaryFieldDefinition

2	Place this code in the FORM_LOAD event procedure.

Private Sub Form_Load()

3	This code gets the SortFields collection for the groups:

Set CRXCRXSortFields = CRXReport.GroupSortFields

4	Get the first Summary Field which is the '"SUM of Customer.Last Year's Sales (Currency)".

Set CRXSummaryField = CRXReport.SummaryFields.Item(1)

5	Now add the Group Sort Field.

CRXSortFields.Add CRXSummaryField, crDescendingOrder

6	Finally, display the report.

CRViewer1.ReportSource = CRXReport

CRViewer1.ViewReport

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Modifying a group’s sort direction at runtime

You can change a group’s sort direction through the SortDirection property of the Area Object. To change a group’s sort direction you can use code similar to the following:

Note: All the samples are based on the sample database, XTREME.MDB, which is installed by Crystal Reports.

1	Put this code in the General Declarations section.

Dim CRXReport As New CrystalReport1

2	Put this code in the FORM_LOAD event procedure.

Private Sub Form_Load()

The Item parameter "GH1" refers to the first group header; to access the second group header you would use "GH2" This line of code sets the SortDirection to descending.

CRXReport.Areas.Item("GH1").SortDirection = crDescendingOrder

3	Finally, view the report.

CRViewer1.ReportSource = CRXReport

CRViewer1.ViewReport

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with parameter fields

Crystal parameters and stored procedure parameters and are both set through the ParameterFieldDefinition Object. The following sample code passes four parameters to a report. The Main Report and the Subreport each have a Stored Procedure and a Crystal Parameter.

This code can go in the General Declarations Section.

Private Sub Command1_Click()

Dim CRXParamDefs As CRAXDRT.ParameterFieldDefinitions

Dim CRXParamDef As CRAXDRT.ParameterFieldDefinition

Dim CRXSubreport As CRAXDRT.Report

Set CRXParamDefs = CRXReport.ParameterFields

This code cycles through the ParameterFieldDefinitions collection in the main report.

For Each CRXParamDef In CRXParamDefs

With CRXParamDef

Select Case .ParameterFieldName

It finds and sets the appropriate Crystal parameter.

Case "MainParam"

.SetCurrentValue "Main Report Parameter"

Now it finds and sets the appropriate stored procedure parameter.

Case "[CustomerID]"

.SetCurrentValue "Alfki"

End Select

End With

Next

It opens the appropriate subreport.

Set CRXSubreport = CRXReport.OpenSubreport("sub1")

Set CRXParamDefs = CRXSubreport.ParameterFields

It cycles through the ParameterFieldDefinitions collection for the subreport.

For Each CRXParamDef In CRXParamDefs

With CRXParamDef

MsgBox .ParameterFieldName

Select Case .ParameterFieldName

It finds and sets the appropriate Crystal parameter for the subreport.

Case "SubParam"

.SetCurrentValue "Subreport Parameter"

Now it finds and sets the appropriate stored procedure parameter for the subreport.

Case "[CustomerID]"

.SetCurrentValue "Anton"

End Select

End With

Next

 Finally, it disables parameter prompting so the user won’t be prompted for a value.

CRXReport.EnableParameterPrompting = False

CRViewer1.ReportSource = CRXReport

CRViewer1.ViewReport

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with OLE objects

Setting the location of an OLE object

This example demonstrates how you can set the location of an OLE object at Runtime using the SetOleLocation command. The example takes three different OLE objects:

 	a bitmap

 	part of an Excel worksheet

 	part of a Word document.

It cycles through them so the RDC prints a different object each time it formats the Details section.

Option Explicit

Private Sub Report_Initialize()

    Database.Tables(1).Location = App.Path + "\Author.mdb"

End Sub

Private Sub SectionDetails_Format(ByVal pFormattingInfo As Object)

Object to hold the bitmap:

Dim bmpHold As StdPicture

    Dim iModNum As Integer

Calculate an integer to pass in as the object name.

    iModNum = cRecNum.Value Mod 3 + 1

Take an action based on the integer passed in.

    Select Case iModNum

The bitmap object:

Case 1

Set the variable to a bitmap.

        Set bmpHold = LoadPicture(App.Path & res\SampleBitmap1.bmp")

Set the height and width of the Report object equal to the actual values for the bitmap - the StdPicture object defaults to HiMetric, the Report uses twips.

Set the bitmap on the Report equal to the variable.

        Set cOLEObj.FormattedPicture = bmpHold

Convert from HiMetric to twips.

        cOLEObj.Height = bmpHold.Height * 567 / 1000

        cOLEObj.Width = bmpHold.Width * 567 / 1000

The Excel Worksheet object:

Case 2

        cOLEObj.SetOleLocation App.Path & "\res\SampleExcel1.xls"

        cOLEObj.Height = 1800

         cOLEObj.Width = 5791

The Word Document object:

Case 3

        cOLEObj.SetOleLocation App.Path & "\res\SampleWord1.doc"

        cOLEObj.Height = 322

        cOLEObj.Width = 8641

    End Select

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Sorting

Changing the existing sort's condition field

For this scenario, a report is created which is currently sorted on the Customer Name field (For example, {Customer.Customer Name}). To change the condition field for the existing field at runtime, the following code can be used:

'General Declarations

Dim CRXReport As New CrystalReport1

Dim CRXDatabaseField As CRAXDRT.DatabaseFieldDefinition

Private Sub Form_Load()

Currently the sort is based on the Customer Name field and the application is to change it to the Last Year's Sale's field. This field must be present on the report. The code accesses the first table to get the 8th field.

Set CRXDatabaseField = CRXReport.Database.Tables.Item(1).Fields.Item(8)

There is only one Sort on this report so we will access the first item of the SortFields collection and set the field to the Last Year's Sale's field.

CRXReport.RecordSortFields.Item(1).Field = CRXDatabaseField

CRViewer1.ReportSource = CRXReport

CRViewer1.ViewReport

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding a new sort field to a report

In this example, we’re going to add a sort field that currently isn’t sorted.

You can put code like this in the General Declarations section.

Dim CRXReport As New CrystalReport1

Dim CRXDatabaseField As CRAXDRT.DatabaseFieldDefinition

Private Sub Form_Load()

Currently there is no sort in this Report. To add the sort field Customer Name, the application must first get the {Customer.Customer Name} field from the Customer Table. This code accesses the first table to get the 2nd field.

Set CRXDatabaseField = CRXReport.Database.Tables.Item(1).Fields.Item(2)

Now add the field to the SortFields Collection and set the Sort Order to ascending.

CRXReport.RecordSortFields.Add CRXDatabaseField, crAscendingOrder

Note: If the SortField is added while the Report is viewing, you will have to refresh the viewer before the new sort will be active. This can be done by clicking the Refresh button in the Report Viewer or refreshing the viewer through code. For example,

    CRViewer1.Refresh

    CRViewer1.ReportSource = CRXReport

    CRViewer1.ViewReport

    End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Summary Fields

How to change summary field kind

This example populates a combo box with the various summary field kind options and then sets a summary field to the kind selected. This code assumes that you have elsewhere declared a variable cr for your report.

Private Sub Form_Load()

Dim i As Integer

Populate the combo box.

cmbSummaryType.AddItem "crSTSum"

cmbSummaryType.AddItem "crSTAverage"

cmbSummaryType.AddItem "crSTSampleVariance"

cmbSummaryType.AddItem "crSTSampleStandardDeviation"

cmbSummaryType.AddItem "crSTMaximum"

cmbSummaryType.AddItem "crSTMinimum"

cmbSummaryType.AddItem "crSTCount"

cmbSummaryType.AddItem "crSTPopVariance"

cmbSummaryType.AddItem "crSTPopStandardDeviation"

cmbSummaryType.AddItem "crSTDistinctCount"

Get the SummaryFields collection.

Set CRXSummaryFieldDefinitions = CRXReport.SummaryFields

txtCount = CrystalSummaryFieldDefinitions.Count

Cycle through the collection.

For i = 1 To CRXSummaryFieldDefinitions.Count

    Set CRXSummaryFieldDefinition = CRXSummaryFieldDefinitions.Item(i)

    lstFieldDefinition.AddItem CRXSummaryFieldDefinition.Name

Next i

End Sub

Change the summary field kind.

Private Sub lstFieldDefinition_Click()

    Set CRXSummaryFieldDefinition = CRXSummaryFieldDefinitions.Item(lstFieldDefinition.ListIndex + 1)

    With CRXSummaryFieldDefinition

        cmbSummaryType.Text = cmbSummaryType.List(.SummaryType)

        txtKind = .Kind

        txtName = .Name

        txtNumberofBytes = .NumberOfBytes

        txtValue = OnFormat

        txtValueType = .ValueType

    End With

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Text Objects

Simple and complex text objects

There are two types of text objects: simple and complex.

 	Simple text objects are processed internally by the report engine.

 	Complex complex text objects are handled by CRPAIG32.DLL.

Only complex text objects can handle carriage returns and line feeds.

If you want to use carriage returns and line feeds in your text object, you will need to force the text object to be complex. To do this, double-click on the text object to edit it and enter a carriage return (press the enter key) inside of it. Then, when carriage returns and line feeds are passed to the text object through your code, the RDC will process them properly.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Changing the contents of a Text Object

You can use text objects in a variety of different ways:

 	You can use a text object in a simple way to personalize a report based on your users’ input (changing the report title, for example).

 	You can also use a text object to display the results of complex operations on database data.

Text objects are very flexible and powerful reporting tools.

To change the contents of a text object you use the SetText method.

 	The Text property of the object model’s TextObject gives you information about the existing value; it is a read-only property however.

 	To assign a new value to the property, you must use the SetText method.

Note: The following examples change the contents of a Text object during the Load event of the Form containing the Crystal Report Viewer ActiveX control. This is especially important if the value of your text object is dependent on data in your data source. Since this is also a common place to change the data source used by a report, changing values in Text objects during the Load event often becomes convenient.

Making a simple text change

This example simply assigns a string to the Text1 object in the report.

Private Sub Form_Load()

    Dim CRXReport As New CrystalReport1

    ’More code here

    CRXReport.Text1.SetText "Here is some text from my app"

    CRViewer1.ReportSource = CRXReport

    CRViewer1.ViewReport

End Sub

Displaying a calculated result

A more complicated technique may be to access data in a database, calculate a new value in Visual Basic, and then display that value through a Text object on the report. In such cases, you can supply a text object for each result when you design your report in RDC Designer. The following code assumes that you have done this:

Private Sub Form_Load()

Set up the variables.

    Dim maxValue As Currency

    Dim maxValueString As String

    Dim CRXReport As New CrystalReport1

    Dim rs As New ADODB.Recordset

Set your data source.

rs.Open "SELECT * FROM Customer", _

"DSN=Xtreme Sample Database;", adOpenKeyset

CRXReport.Database.SetDataSource rs

maxValue = 0

Read the records and calculate the results.

    rs.MoveFirst

    Do While Not rs.EOF

       If rs.Fields("Last Year’s Sales") > maxValue Then

             maxValue = rs.Fields("Last Year’s Sales")

        End If

        rs.MoveNext

    Loop

Format and assign the results to the text object.

    maxValueString = "The maximum value is " & _

        Format(maxValue, "Currency")

    CRXReport.Text1.SetText maxValueString

Preview the report.

    CRViewer1.ReportSource = CRXReport

    CRViewer1.ViewReport

End Sub

In this example, we are finding the maximum value of the Last Year’s Sales field from the new data source, formatting that value as Currency, then displaying a message containing the value through a Text object on the report. As you can see, Text objects provide many options for controlling the output of data in your reports.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Programming the Crystal Report Viewers

The Crystal Report Viewer is a front-end user interface for viewing reports. In this section you will find detailed information on implementing the ActiveX and Java Bean viewers in your application.

Click the appropriate link to jump to that section:

 	Enhancements to the Report Viewer

 	Crystal Report Viewer for ActiveX

 	The Crystal Report Viewer Java Bean

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Enhancements to the Report Viewer

The Report Viewer has been enhanced substantially in Version 8:

 	The Report Viewer uses multi-threading. As a result, your users can begin viewing a report sooner, even if the report requires that it all be run before certain values are generated (page numbering, for example, of the style “page 24 of 125”). In such a case, the Report Engine uses place holders for the yet-to-be-generated total page count. When that page count is completed, the Report Engine inserts the missing data into the pages already read.

 	The report’s group tree is loaded on-demand. This allows your users to use the tree functionality for navigation even when only a partial group tree has been loaded.

 	You can specify a page number to go to in the report you are currently viewing.

 	You can use the Select Expert and the Search Expert in the viewer to select records and search for specific values using formulas.

 	The Report Viewer supports the use of rotated text in the report.

 	The toolbar for the Report Viewer for ActiveX has a new look.

 	You can customize the Report Viewer by resizing sections of the toolbar, adding custom bitmaps, and more.

 	There is a Help button implemented for applications. Clicking on the Help button can fire an event to your application so it can display the appropriate help.

 	There are over 30 events giving you the ability to make previewing the report a truly interactive activity.

For a better understanding of all the capabilities of the Report Viewer, review the viewer object model (CRVIEWERLibCtl) in the Visual Basic Object Browser.

Note: Visit the Seagate Software Developer Zone web site at http://www.seagatesoftware.com/products/dev_zone. Click Support to get links for finding documentation and knowledge base articles about the Report Designer Component.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Application Development with Crystal Report Viewers

Developing applications that display reports on screen is now a straightforward process. Crystal Reports includes the Crystal Report Viewers as easy to use but complex components that can be embedded directly in an application. Once added to an application, reports accessed through the Report Engine Automation Server, the Report Designer Component, or the Crystal Web Reports Server can be displayed right inside your own applications. The Report Viewer retains all of the powerful formatting, grouping, and totalling power of the original report, and your users get access to data in a dynamic and clear format.

Crystal Reports provides two Report Viewers specifically designed for application development: the Crystal Report Viewer for ActiveX and the Crystal Report Viewer Java Bean. Both provide a complete object model for programming and manipulating the Report Viewer at runtime inside your applications. Simply displaying a single report inside the Report Viewer is a simple process requiring only a couple of lines of code. However, if necessary for your application, you have the option of complete control over how the Report Viewer appears and functions.

With the Crystal Report Viewer as a front-end user interface for viewing reports, Crystal Reports development technologies allow you to develop even complex client/server or multi-tier applications that access, manipulate, and display data for intranet systems, workgroups, or any group of people needing clear and informative data on a regular basis. Design robust Business Support systems and Enterprise Information Management applications delivering even the most complex data through the Crystal Report Viewers.

This chapter describes both the ActiveX and Java Bean versions of the Report Viewer in relation to designing applications using Crystal Reports development technologies. If you are interested in creating web sites that display reports, you should also review Crystal Reports Web Administrator’s Guide, which describes the HTML and Java applet versions of the Report Viewer as well.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Report Viewer for ActiveX

The Crystal Report Viewer for ActiveX is a standard ActiveX control that can be added to an application in any development environment that supports ActiveX. Programmers using Visual Basic, Delphi, Visual C++, or Borland C++ programmers all receive the benefit of quickly adding a powerful report viewer to an application with little coding.

As a standard component, the ActiveX Report Viewer exposes several properties at design time, but also provides a complete object model with properties, methods, and events that can be programmed at runtime. The following sections discuss various topics for working with the ActiveX Report Viewer in Visual Basic. If you are using a development environment other than Visual Basic, use these topics as a guideline, but refer to your development software documentation for specific information on working with ActiveX controls.

The Crystal Report Viewer, as an ActiveX control, includes a complete object model for controlling how it appears in an application, and how it displays reports. Simply displaying a report in the Report Viewer window takes little code, but to truly make use of its power requires a broader understanding of how to work with the object model.

Related topics

Adding the Report Viewer to a Visual Basic project

Using the CRViewer object

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding the Report Viewer to a Visual Basic project

If you create a new report using the Create Report Expert in the Crystal Report Designer Component, the Report Viewer control can be automatically added to a Form in your Visual Basic project. However, there may be times when you need to add the control by hand. In addition, the Report Viewer control can be implemented in other environments, many of which may not support ActiveX designers, meaning the Create Report Expert is unavailable.

Use the following steps to add the Crystal Report Viewer ActiveX control to a Form in your Visual Basic application. This tutorial assumes the Form already exists in your project and is named Form1.

1	First, you must verify that a reference to the Report Viewer control exists in your project. From the Project menu, select the Components command. The Components dialog box appears.

2	On the Controls Tab of the Components dialog box, scroll through the list of ActiveX controls until you find Crystal Report Report Viewer.

Note: If you do not see the Crystal Report Report Viewer control in the list, use the Browse button to locate the CRVIEWER.DLL component in the C:\Program Files\Seagate Software\Viewers\ActiveXViewer directory.

3	If the check box next to the Report Viewer control is not toggled on, toggle it on now.

4	Click OK, and the CRViewer control will appear in the Visual Basic toolbox.

5	Click the CRViewer control on the toolbox, then draw the Report Viewer control on your form by dragging a rectangle across the form with the mouse pointer. An instance of the control will be added to your Form.

6	Adjust the size and position of the Report Viewer on your form, and use the Properties window to adjust the overall appearance of the control.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using the CRViewer object

The CRViewer object represents an instance of the Report Viewer control that has been added to your project. If you have created a report using the Crystal Report Designer Component and accepted the defaults for adding the Report Viewer to your project, the Report Viewer control in your application will be named CRViewer1. CRViewer1 can be used in your code as a CRViewer object. For instance, the following code demonstrates a simple technique for assigning a report to the Report Viewer, and displaying it:

CRViewer1.ReportSource = reportCRViewer1.ViewReport

For more information on the properties and methods available with this object, refer to the Report Viewer object model and the CRViewer object.

The topics listed below describe several aspects of the Report Viewer object model and present examples of how to use the Report Viewer objects, methods, properties and events in your Visual Basic code.

 	Specifying a report

 	Working with secure data in reports

 	Handling Report Viewer events

 	Moving through a report

 	Printing the report

 	Controlling the appearance of the Report Viewer

 	Connecting to the Web Reports Server

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Specifying a report

The most important task with the Report Viewer control is to specify a report and display it at runtime. This is easily handled with the ReportSource property and the ViewReport method.

Private Sub Form1_Load()

    Dim report As New CrystalReport1

    CRViewer1.ReportSource = report

    CRViewer1.ViewReport

End Sub

In this example, assigning the report and displaying it in the Report Viewer is handled when the Form containing the Report Viewer object is loaded into the application. A reference to the report is first obtained in the form of a Report object representing a Crystal Report Designer Component that has been added to the Visual Basic project.

ReportSource is a property of the Report Viewer’s CRViewer object which corresponds directly to the Report Viewer control added to the project. In this case, that control has been named CRViewer1. The ReportSource property can accept a report in the form of a Report Object exposed by the Report Designer Component or the Crystal Web Reports Server.

Finally, the ViewReport method is called. This method has no parameters and has the job simply of displaying the specified report inside the Report Viewer control.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with secure data in reports

If your report connects to a secure data source that requires log on information, you must release the Report object from the Report Viewer before you can log off of the data source. This can be done by assigning a new Report object to the ReportSource property, or by closing the CRViewer object. Until this is done, the data source will not be released from the Report object and you cannot log off.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Handling Report Viewer events

The Report Viewer control allows you to write custom code for several events relating to user interaction with both the control window and the report displayed. For instance, if you design a drill down report using the Report Designer Component, your users are likely to want to drill down on detail data. You can provide custom handling of such an event by writing code fort the DrillOnGroup event.

To add event procedures to the Report Viewer control for the DrillOnGroup and PrintButtonClicked events:

1	In the Visual Basic Project window, select the Form containing the Report Viewer control.

2	Click the View Code button in the toolbar for the Project window. A code window for the form appears.

3	In the drop-down list box at the upper left hand corner of the code window, select the CRViewer1 control. (This name will appear different if you changed the Name property of the control in the Properties window.)

4	In the drop-down list box at the upper right corner of the code window, select the DrillOnGroup event. A procedure appears for handling the event.

5	Add the following code to the DrillOnGroup event procedure:

Private Sub CRViewer1_DrillOnGroup(GroupNameList As Variant, _

    ByVal DrillType As CRVIEWERLibCtl.CRDrillType, UseDefault As Boolean)

    MsgBox "You're drilling down on the " & GroupNameList(0) & " group!"

End Sub

6	In the drop-down list box at the upper right of the code window, select the PrintButtonClicked event. A new procedure appears for this event.

7	Add the following code for the new event:

Private Sub CRViewer1_PrintButtonClicked(UseDefault As Boolean)

    MsgBox "You clicked the Print button!"

End Sub

The DrillOnGroup event is triggered when a user double-clicks on a chart, on a map, or on a report summary field. The code added to the event procedure will display a message box with the name of the group. The PrintButtonClicked event is fired if the user clicks the print button on the Report Viewer window. Note that any code added to these event handlers replaces the default action of the event. A more practical use of these events would be to display custom dialogs or perform other report related calculations and procedures.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Moving through a report

Often, reports consist of several pages. The Report Viewer control provides, by default, controls that allow a user to move through the pages of the report. However, you may need to implement a system through which your own code controls when separate pages are displayed.

The CRViewer object provides several methods for moving through a report, including methods to move to specific pages:

 	ShowFirstPage

 	ShowLastPage

 	ShowNextPage

 	ShowPreviousPage

 	ShowNthPage

 	GetCurrentPageNumber

And methods for moving to specific groups in the report:

 	ShowGroup

Moving through pages

The first set of methods designed for moving through the pages of a report are straightforward and correspond directly to controls that normally appear on the Report Viewer control window. ShowFirstPage, ShowLastPage, ShowNextPage, and ShowPreviousPage simply switch to the first, last, next, or previous page in the report, respectively. They are all used in the same manner in code:

CRViewer1.ShowFirstPage

CRViewer1.ShowLastPage

CRViewer1.ShowNextPage

CRViewer1.ShowPreviousPage

If the requested page cannot be displayed, for instance, if the last page in the report is currently displayed and ShowNextPage is called, the currently displayed page will be refreshed.

For more controlled movements through the report, ShowNthPage can display a specific page of the report:

CRViewer1.ShowNthPage 5

This method accepts a page number as its only argument. If the selected page number does not exist, for example, page 10 is selected from a 6 page report, then either the last or first page will be displayed, depending on the page number requested.

As a convenience, the GetCurrentPageNumber method has also been included. You can obtain the currently displayed page from within your code at any time using this method:

Dim pageNum As Long

pageNum = CRViewer1.GetCurrentPageNumber

Moving to a specific group

Grouping is a common feature of reports, and, since page numbers can frequently change based on current data, it may be more appropriate to navigate through a report using groups. For example, if a report is grouped by cities within states, and by states within countries, you can include code to display the group for a specific city.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Printing the report

Although the Report Viewer control is designed primarily for displaying reports on screen, users frequently want a hard-copy of the data. The PrintReport method provides a simple means of allowing access to the Windows print features. Simply call the method as below, and Windows can take over.

Dim Report As New Crystalreport1

CRViewer1.ReportSource = Report

CRViewer1.PrintReport

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Controlling the appearance of the Report Viewer

By default, the Report Viewer window includes several controls for allowing users to navigate through a report, enlarge the view of a report, refresh the data in a report, and more. There may be applications that you create in which you want to limit a user’s interaction, change the look of the Report Viewer window, or provide an alternate means of accessing the same functionality.

For instance, you could turn off the navigation controls in the Report Viewer, then create your own controls to navigate through the report that call the ShowFirstPage, ShowLastPage, ShowNextPage, ShowPreviousPage, and ShowNthPage methods. (See Moving through a report.) For handling such custom features, the Report Viewer object model provides several properties for enabling and disabling different features of the Report Viewer ActiveX control:

 	DisplayBackgroundEdge

 	DisplayBorder

 	DisplayGroupTree

 	DisplayTabs

 	DisplayToolbar

 	EnableAnimationCtrl

 	EnableCloseButton

 	EnableDrillDown

 	EnableGroupTree

 	EnableNavigationControls

 	EnablePrintButton

 	EnableProgressControl

 	EnableRefreshButton

 	EnableSearchControl

 	EnableStopButton

 	EnableToolbar

 	EnableZoomControl

Using these properties requires assigning a value of either True or False. True enables the specified control or feature of the Report Viewer, while False disables it. All controls and features are, by default, enabled.

The following code demonstrates how to disable the entire toolbar for the Report Viewer window:

CRViewer1.DisplayToolbar = False

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Connecting to the Web Reports Server

The Web Reports Server provides not only a powerful means of distributing reports across the web, but also provides a report distribution mechanism that can be incorporated into multi-tier applications. By using the Crystal Report Viewer for ActiveX as a client-side report viewer, the Web Reports Server can become a report distribution engine within a larger application that runs over a network.

Connecting to the Web Reports Server requires accessing two new ActiveX components: the WebReportBroker and the WebReportSource. The following samples demonstrate how to connect to the Web Reports Server using Connecting from Visual Basic, and Connecting from VBScript, inside a web page.

Connecting from Visual Basic

The following code is an example of how to connect to the Web Reports Server from Visual Basic and assign a report to the Crystal Report Viewer for ActiveX. This assumes that you have added the ActiveX viewer control to a form named Form1, and the ActiveX viewer control is named CRViewer1.

Private Sub Form1_Load()

    Dim webBroker, webSource

    Set webBroker = CreateObject("WebReportBroker.WebReportBroker")

    Set webSource = CreateObject("WebreportSource.WebReportSource")

    webSource.ReportSource = webBroker

    webSource.URL = "http://<machinename>/scrreports/xtreme/hr.rpt"

    webSource.Title = "Employee Profiles"

    CRViewer1.ReportSource = webSource

    CRViewer1.ViewReport

End Sub

Connecting from VBScript

The following code assumes you have added the Crystal Report Viewer for ActiveX to a web page using the <OBJECT> tag and assigned it an ID of CRViewer. For an example of this, refer to Crystal Reports Web Administrator’s Guide.

<OBJECT ID="WebSource" Width=0 Height=0>

    CLASSID="CLSID:F2CA2115-C8D2-11D1-BEBD-00A0C95A6A5C"

    CODEBASE="viewer/ActiveXViewer/swebrs.dll#Version=1.2.0.5"

</OBJECT>

<OBJECT ID="WebBroker" Width=0 Height=0>

    CLASSID="CLSID:F2CA2119-C8D2-11D1-BEBD-00A0C95A6A5C"

    CODEBASE="viewer/ActiveXViewer/swebrs.dll#Version=1.2.0.5"

</OBJECT>

<OBJECT ID="Export" Width=0 Height=0>

    CLASSID="CLSID:BD10A9C1-07CC-11D2-BEFF-00A0C95A6A5C"

    CODEBASE="viewer/ActiveXViewer/sviewhlp.dll#Version=1.0.0.4"

</OBJECT>

<SCRIPT LANGUAGE="VBScript">

<!--

Sub Page_Initialize

    Dim webBroker

    Dim webSource

    Set webBroker = CreateObject("WebReportBroker.WebReportBroker")

    Set webSource = CreateObject("WebReportSource.WebReportSource")

    webSource.ReportSource = webBroker

    webSource.URL = Location.Protocol + "//" + Location.Host + _

        "/scrreports/xtreme/invent.rpt"

    CRViewer.ReportSource = webSource

    CRViewer.ViewReport

End Sub

-->

</SCRIPT>

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Crystal Report Viewer Java Bean

The Crystal Report Viewer Java Bean (or Report Viewer Bean) can be added to an application in any development environment that supports Java (version 1.1). Programmers receive the benefit of quickly adding a powerful report viewer to an application with little coding.

As a standard component, the Crystal Report Viewer Java Bean exposes several properties at design time, but also provides a complete object model with properties, methods, and events that can be programmed at runtime. The following discusses one approach to creating an application using the Crystal Report Viewer Java Bean. It describes the creation of a simple Applet which will allow a report to be viewed from your browser.

This example uses the Bean Box a component of the Bean Developer Kit (BDK) from Sun Microsystems Inc. The Bean Box is not intended to be used for serious application development, rather as a platform for testing Beans interactively at design time, and creating simple applets for run time testing. The Bean Box is available for download from Sun Microsystems.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding the Report Viewer Bean to the project

To add the Report Viewer Bean to the Bean Box:

1	Locate the JAR file called ReportViewerBean.jar in the "Viewers" directory   (\SeagateSoftware\Viewers\JavaViewerBean)

2	Either copy the file to the \jars subdirectory of the BDK

or

From the Bean Box Select LoadJar from the File menu and specify the pathname of the file

3	The Crystal Report Viewer Icon should appear in the ToolBox palette.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Creating a simple applet with the Report Viewer

To add the Report Viewer Bean to the Bean Box Composition window and create an applet:

1	Click on the Report Viewer Beans name (Crystal Report Viewer) in the ToolBox palette.

2	Click on the location in the Bean Box Composition window where you want the Report Viewer Bean to appear.

3	Resize the Report Viewer in the Composition window until you are able to see the controls and report window.

4	In the Bean Box Property Sheet window you will see the list of Report Viewer Bean properties. These can be set and edited. For example to view a report click on the reportName property. When the dialog box appears enter the URL of a report file (for example: "http://localhost/scrreports/craze/adcont2s.rpt").

The report should be displayed in the Crystal Report Viewer Report window.

5	To create a simple applet select MakeApplet from the File menu. This will create an applet which when called from your browser will display the report specified in the reportName property. You will be prompted to specify a directory where your applet and its supporting file will be placed (or the default tmp subdirectory of the beanbox directory).

If you look at the directory containing the applet, you will notice that there are a number of supporting files and directories. Locate the html file (<appletname>.html) and click on it. Your default browser should display the Report Viewer and the report.

The minimum required to actually run the application using the bean is:

 	 the html file which references the applet class file

 	 the extracted ReportViewerBean.jar file and any supporting jar files

 	 the applet class file

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Programming the Embeddable Crystal Reports Designer Control

This section demonstrates how to integrate the Embeddable Crystal Reports Designer Control (Embeddable Designer) into your application. Included are tutorials on creating sample applications in both Microsoft Visual Basic and Microsoft Visual C++. A brief section on creating reports in the designer at runtime is also included.

Click the appropriate link to jump to that section:

 	Overview

 	Creating a Microsoft Visual Basic sample application with the Embeddable Designer

 	Creating a Microsoft Visual C++ sample application with the Embeddable Designer

 	Designing reports in the Embeddable Designer

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview

The Embeddable Crystal Reports Designer Control (Embeddable Designer) is a new addition to the Report Designer Component. Easily integrated into your application, the Embeddable Designer provides your users with an interactive environment to design or edit Crystal Reports.

The following examples demonstrate how to create a sample application using the Embeddable Designer in both Microsoft Visual Basic and Microsoft Visual C++. Two tutorials are provided:

 	Creating a Microsoft Visual Basic sample application with the Embeddable Designer

 	Creating a Microsoft Visual C++ sample application with the Embeddable Designer.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Creating a Microsoft Visual Basic sample application with the Embeddable Designer

This tutorial assumes that you have prior knowledge of Microsoft Visual Basic, Crystal Reports, and the Report Designer Component. The following procedure and sample code detail how to create an application that demonstrates the Embeddable Designer. The application will consist of a single form with a tab control and buttons to create a new report or open an existing report. The tab control has two property pages. The first page (Designer tab) contains the Embeddable Designer, and the second page (Viewer tab) contains the Crystal Reports Viewer Control. See Programming the Crystal Report Viewers. With the application running, you will be able to open a new report or an existing report in the Embeddable Designer. After designing or editing a report, view it in the Crystal Report Viewer. When you go back to the Embeddable Designer to make changes, you’ll see those changes updated automatically in the Crystal Report Viewer.

Note: The sample application was created in Microsoft Visual Basic version 6.0 with Service Pack 4.

This tutorial contains the following steps:

 	Step 1: Creating the user interface (Microsoft Visual Basic)

 	Step 2: Writing the code (Microsoft Visual Basic)

 	Step 3: Running the Embeddable Designer application (Microsoft Visual Basic).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 1: Creating the user interface (Microsoft Visual Basic)

To return to the introduction, go to Creating a Microsoft Visual Basic sample application with the Embeddable Designer.

In this step, you will add the references, components, forms, and controls for the application.

1	Create a new Standard EXE project.

2	Add the following components to the project:

 	Crystal Reports Viewer Control

 	Embeddable Crystal Reports 8.5 Designer Control

 	Microsoft Common Dialog 6.0

 	Microsoft Tabbed Dialog Control 6.0 (Sp4).

3	Add the following reference to the project:

 	Crystal Reports 8.5 ActiveX Designer Design and Runtime Library.

Note: See Programming the Crystal Report Viewers for more information.

4	Add the following controls from the Toolbox to the form:

 	three CommandButton controls

 	Common Dialog (Microsoft Common Dialog Control 6.0)

 	SSTab1 (Microsoft Tabbed Dialog Control 6.0 (SP4))

 	CRDesignerCtrl (Embeddable Crystal Reports 8.5 Designer Control)

 	CRViewer (Crystal Report Viewer Control).

5	Set the properties for the form and the controls:

 	Form1 (Main form for the application):

 	Name = frmMain

 	Caption = Embeddable Crystal Reports 8.5 Designer Control Sample

 	Height = 8265

 	Width = 10815

 	SStab (Tabbed control containing the Embeddable Designer and Report Viewer controls):

Note: Click the tabs on SSTab1 to access the separate Caption properties.

 	Name = SSTab1

 	Tabs = 2

 	Tab1 Caption = Design

 	Tab2 Caption = Preview

 	Enabled = False

 	Height = 7600

 	Left = 0

 	Tab Height = 300

 	Top = 130

 	Width = 10825

 	CRDesignerCtrl1 (Designs and edits reports):

Note: Place the control on the tab labeled “Designer.”

 	Name = CRDesignerCtrl1

 	Height = 6540

 	Left = 0

 	Top = 0

 	Width = 10325

 	CRViewer (Views reports):

 	Name = CRViewer1

 	Height = 10340

 	Left = 120

 	Top = 360

 	Height = 6600

 	CommonDialog (Creates an Open dialog to select reports):

 	Name = CommonDialog1

 	Filter = Crystal Reports |*.rpt

 	Button1 (Creates a new report):

 	Name = cmdNewReport

 	Caption = &New Report

 	Left = 120

 	Top = 7850

 	Button2 (Opens an existing report):

 	Name = cmdOpenReport

 	Caption = &OpenReport

 	Left = 1950

 	Top = 7850

 	Button3 (Closes the form and exits the application):

 	Name = cmdExit

 	Caption = E&xit

 	Left = 9030

 	Top = 7850

To continue with this procedure, go to Step 2: Writing the code (Microsoft Visual Basic).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 2: Writing the code (Microsoft Visual Basic)

To return to the previous part of this procedure, go to Step 1: Creating the user interface (Microsoft Visual Basic).

In this step you will add the code to:

 	create a new report

 	create an Open dialog box to open an existing report

 	set the report object to CRDesignerCtrl1 and view the report in design mode

 	set the report object to CRViewer1, set the zoom level, and view the report

 	refresh the report when switching from the Designer tab to the Viewer tab on the Microsoft Tabbed Dialog Control.

1	Type or insert the sample code below into the code module of frmMain.

2	Once you have added the code, on the Run menu click Start to run the application.

Note: Error handling is not included in the code samples.

Option Explicit

Dim m_Application As New CRAXDDRT.Application

Dim m_Report As CRAXDDRT.Report

' *************************************************************

'DisplayReport is a procedure that

' - Enables the Tab control the first time a report is created

'   or opened.

' - Sets the report object to the Embeddable Designer(CRDesigner1).

' - Disables the Help menu in the Embeddable Designer.

' - Sets the report object to the Crystal Report Viewer Control

'   (CRViewer1).

' - Sets the Crystal Reports Viewer to view the report.

'

Public Sub DisplayReport()

' Enable the tab control if disabled.

If SSTab1.Enabled = False Then SSTab1.Enabled = True

' Set the Report Object

CRDesignerCtrl1.ReportObject = m_Report

' Note----------------

' Set all other properties for CRDesignerCtrl1 after setting the

' ReportObject property

' --------------------

' Disable the Help menu

CRDesignerCtrl1.EnableHelp = False

' Set the report source

CRViewer1.ReportSource = m_Report

' Set the viewer to view the report

CRViewer1.ViewReport

' Set the zoom level to fit the page

' to the width of the viewer window

CRViewer1.Zoom 1

End Sub

' *************************************************************

Private Sub Form_Load()

'Set the tab control to display the Designer tab

'when the form is loaded

SSTab1.Tab = 0

End Sub

' *************************************************************

Private Sub SSTab1_Click(PreviousTab As Integer)

' Refresh the report when clicking Preview,

' without refreshing the data from the server.

If PreviousTab = 0 Then CRViewer1.RefreshEx False

End Sub

' *************************************************************

' Create a new report and display it in the Embeddable Designer

'

Private Sub cmdNew_Click()

' Set the report object to nothing

Set m_Report = Nothing

' Create a new report

Set m_Report = m_Application.NewReport

' Call DisplayReport to set the report to the Embeddable Designer

' and the Crystal Report Viewer and then display the report in the

' Embeddable Designer.

Call DisplayReport

End Sub

' *************************************************************

' Use the Microsoft Common Dialog control to open a report.

'

Private Sub cmdOpen_Click()

CommonDialog1.CancelError = True

On Error GoTo errHandler

' Display the open dialog box

CommonDialog1.ShowOpen

' Set the report object to nothing

Set m_Report = Nothing

' Open the selected report

Set m_Report = m_Application.OpenReport(CommonDialog1.FileName, 1)

' Call DisplayReport to set the report to the Embeddable Designer

' and the Crystal Report Viewer

Call DisplayReport

Exit Sub

errHandler:

'User cancelled dialog

End Sub

' *************************************************************

Private Sub cmdAbout_Click()

frmAbout.Show vbModal

End Sub

' *************************************************************

Private Sub cmdExit_Click()

Unload Me

End Sub

To continue with this procedure, go to Step 3: Running the Embeddable Designer application (Microsoft Visual Basic).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 3: Running the Embeddable Designer application (Microsoft Visual Basic)

To return to the previous part of this procedure, go to Step 2: Writing the code (Microsoft Visual Basic).

In this step you will:

 	create and design a new report in the Embeddable Designer

 	view the report and any changes made to the report

 	open and edit an existing report in the Embeddable Designer

 	view the report and any changes made to the report.

1	With the application running, click New Report.

An empty report will appear in the Embeddable Designer.

Note: The interface for the Embeddable Designer is the same one used for ActiveX Designer reports created in the Microsoft Visual Basic IDE with the Crystal Reports Report Designer Component.

2	Design a new report to view.

If you are not familiar with the designer environment, see Designing reports in the Embeddable Designer for a step-by-step procedure on creating a simple report off the Xtreme Sample Database ODBC data source.

3	Click Preview to view the report in the Crystal Report Viewer.

4	Click Design and make some changes to the report. Then click Preview to see the changes in the Crystal Report Viewer.

5	Click Open.

6	In the Open dialog box select one of the sample reports and click Open to view the report in the Embeddable Designer.

7	Click Preview to view the report in the Crystal Report Viewer.

8	Click Design and make some changes to the report. Then click Preview to see the changes in the Crystal Report Viewer.

To return to the introduction, go to Creating a Microsoft Visual Basic sample application with the Embeddable Designer.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Creating a Microsoft Visual C++ sample application with the Embeddable Designer

This tutorial assumes that you have prior knowledge of Microsoft Visual C++, Crystal Reports, and the Report Designer Component. The following procedure and sample code create an application that demonstrates the Embeddable Designer. The application will consist of a main dialogs for the Embeddable Designer, and for the Crystal Reports Viewer Control. For details, see Programming the Crystal Report Viewers.

With the application running, you will be able to open a new or existing report in the Embeddable Designer. After designing or editing a report, you can preview it in the Crystal Report Viewer by clicking the Preview button. You can then return to the Embeddable Designer by clicking the Design button. When you go back to to edit the report, you can see those changes updated automatically by clicking the Preview button again.

This tutorial contains the following steps:

 	Step 1: Creating the User Interface (Microsoft Visual C++)

 	Step 2: Adding member variables and member functions (Microsoft Visual C++)

 	Step 3: Writing the code (Microsoft Visual C++)

 	Step 4: Running the Embeddable Designer application (Microsoft Visual C++).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 1: Creating the User Interface (Microsoft Visual C++)

To return to the introduction, go to Creating a Microsoft Visual C++ sample application with the Embeddable Designer.

In this step, you will create a Dialog-based MFC.EXE application and add the components, and controls for the application.

1	Using the AppWizard, create a starter Dialog-based MFC application. The main dialog will display reports in Embeddable Designer and the Crystal Report Viewer.

 	Project Name: Embeddable_Designer

 	Application Class Name: CEmbeddable_DesignerApp

 	Dialog Class Name: CEmbeddable_DesignerDlg

2	Add the Embeddable Designer Control and the Crystal Report Viewer Control through the Components and Controls Gallery dialog box. The controls are in the Registered ActiveX Controls folder:

 	Embeddable Crystal Reports 8.5 Designer Control

 	Crystal Report Viewer Control

3	Add the following controls from the Toolbox to IDD_EMBEDDABLE_DESIGNER_DIALOG (Embeddable Designer dialog):

 	six buttons

 	Embeddable Crystal Reports 8.5 Designer

 	Crystal Report Viewer

4	Set the properties for the Embeddable Designer dialog and its controls:

 	IDD_EMBEDDABLE_DESIGNER_DIALOG (Create, open, save, design and preview reports):

 	Caption: Embeddable Designer

 	Height: 340

 	Width: 540

 	Embeddable Crystal Reports 8.5 Designer Control (Designs and edits reports):

 	Height: 300

 	Left: 7

 	Top: 7

 	Width: 525

 	Crystal Report Viewer:

 	Height: 300

 	Left: 7

 	Top: 7

 	Width: 525

Note: Either the Embeddable Designer or the Crystal Report Viewer will be hidden depending on wether the user is designing or previewing a report.

 	All Buttons (Common Properties):

 	Align all Buttons to the bottom of the form

 	Height: 14

 	Width: 50

 	Button1 (Creates a new report):

 	ID: IDC_NEW_REPORT

 	Caption: &New Report

 	Left: 7

 	Button2 (Opens an existing report):

 	ID: IDC_OPEN_REPORT

 	Caption: &Open Report

 	Left: 66

 	Button3 (Saves a report):

 	ID: IDC_SAVE_REPORT

 	Caption: &Save Report

 	Left: 125

 	Button4 (Shows the Crystal Report Viewer and hides the Embeddable Designer.):

 	ID: IDC_PREVIEW

 	Caption: &Preview

 	Left: 184

 	Button5 (Shows the Embeddable Designer and hides the Crystal Report Viewer):

 	ID: IDC_SHOW_DESIGNER

 	Caption: &Design

 	Left: 184

 	Button6 (Exits the application):

 	ID: IDCANCEL

 	Caption: E&xit

 	Left: 483

To continue with this procedure, go to Step 2: Adding member variables and member functions (Microsoft Visual C++).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 2: Adding member variables and member functions (Microsoft Visual C++)

To return to the previous part of this procedure, go to Step 1: Creating the User Interface (Microsoft Visual C++).

In this step, you will add the member variables for the controls on the Embeddable Designer dialog and then add member functions, and member variables for the CEmbeddable_DesignerDlg class.

This step is broken into 2 sections:

 	Adding member variables for the Embeddable Designer dialog controls

 	Adding member variables and functions to the CEmbeddable_Designer class

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding member variables for the Embeddable Designer dialog controls

To return to the previous part of this procedure, go to Step 2: Adding member variables and member functions (Microsoft Visual C++).

Use the Class Wizard to create the member variables for the controls.

1	Create member variables for the controls on the Embeddable Designer dialog:

 	Embeddable Designer Control:

 	Control ID: IDC_EMBEDDABLECRYSTALREPORTSDESIGNERCTRL

 	Type: CCRDesignerCtrl

 	Member: m_Designer

 	Crystal Report Viewer Control:

 	Control ID: IDC_CRVIEWER1

 	Type: CCrystalReportViewer4

 	Member: m_Viewer

 	New Report Button:

 	Control ID: IDC_NEW_REPORT

 	Type: CButton

 	Member: m_NewReport

 	Open Report Button:

 	Control ID: IDC_OPEN_REPORT

 	Type: CButton

 	Member: m_OpenReport

 	Save Report Button:

 	Control ID: IDC_SAVE_REPORT

 	Type: CButton

 	Member: m_SaveReport

 	Preview Button:

 	Control ID: IDC_PREVIEW

 	Type: CButton

 	Member: m_Preview

 	Design Button:

 	Control ID: IDC_SHOW_DESIGNER

 	Type: CButton

 	Member: m_ShowDesigner

To continue with this procedure, go to Adding member variables and functions to the CEmbeddable_Designer class.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding member variables and functions to the CEmbeddable_Designer class

To return to the previous part of this procedure, go to Adding member variables for the Embeddable Designer dialog controls.

Add the following member variables, and member functions to the CEmbeddable_Designer class. The code for the functions will be added in Step 3: Writing the code (Microsoft Visual C++).

1	Create the following member variables.

 	Application pointer for the Craxddrt Application Object:

 	Variable Type: IApplicationPtr

 	Variable Name: m_Application

 	Report pointer for the Craxddrt Report Object:

 	Variable Type: IReportPtr

 	Variable Name: m_Report

2	Create the following member function:

 	Function to create or open a report and initialize the controls on the Embeddable Designer form.

 	Function Type: void

 	Function Declaration: InitReport(BOOL bNew)

3	Add a member function for the BN_CLICKED message of each of the following buttons:

 	New Report: (Click to create a new report)

 	Member function name: OnNewReport

 	Open Report: (Click to open an existing report)

 	Member function name: OnOpenReport

 	Save Report: (Click to save the current report)

 	Member function name: OnSaveReport

 	Preview: (Click to Preview the current report)

 	Member function name: OnPreview

 	Design: (Click to edit the current report)

 	Member function name: OnShowDesigner

To continue with this procedure, go to Step 3: Writing the code (Microsoft Visual C++).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 3: Writing the code (Microsoft Visual C++)

To return to the previous part of this procedure, go to Step 2: Adding member variables and member functions (Microsoft Visual C++).

In this step, you will write the code for member functions added in Step 2: Adding member variables and member functions (Microsoft Visual C++); you will also add directives and constants to the source and header files.

This step is broken into 2 sections:

 	Adding directives and constants to the source and header files

 	Adding the code for the CEmbeddable_Designer class

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding directives and constants to the source and header files

To return to the previous part of this procedure, go to Step 2: Adding member variables and member functions (Microsoft Visual C++).

Add the following directives and constants to the Source and Header files.

1	Add a constant to Embeddable_DesignerDlg.cpp.

// Filter for the Open dialog box and the Save As dialog box

static const char BASED_CODE szFilter[] = "Crystal Reports|*.rpt||";

2	Add the directive to Embeddable_Designer.h

//Import the Crystal Reports 8.5 ActiveX Designer Design and Runtime Library

#import "craxddrt.tlb" no_namespace

Note: Copy Craxddrt.tlb to your application directory. Craxddrt.tlb can be found in the \Crystal Reports\Developer Files\include path, off the directory you installed Crystal Reports to.

To continue with this procedure, go to Adding the code for the CEmbeddable_Designer class.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding the code for the CEmbeddable_Designer class

To return to the previous part of this procedure, go to Adding directives and constants to the source and header files.

Type or insert the code for the member functions created in Adding member variables and functions to the CEmbeddable_Designer class. The CEmbeddable_DesignerDlg class handles the basic functionality of the Embeddable Designer sample application. The class will handle all of the report functionality including creating a new report or opening an existing report, and displaying it in the Embeddable Designer or the Crystal Report Viewer. Once a report is designed or edited it can be saved, previewed, or refreshed.

Note: Error handling is not included in the code samples.

1	Add the code to the OnInitDialog function.

 // Hide the Crystal Reports Viewer control and show the

    // Embeddable Designer oontrol.

    m_Viewer.ShowWindow(SW_HIDE);

    m_Designer.ShowWindow(SW_SHOW);

2	Add the code for the InitReport function.

// In this function a report is created or opened. The report is set to

// the Embeddable Designer and Crystal Report Viewer, with the Embeddable

// Designer visible and the Crystal Report Viewer hidden. Then the

// command buttons are initialized so that Save Report, and Preview are

// enabled, and Design is disabled and hidden.

void CEmbeddable_DesignerDlg::InitReport(BOOL bNew)

{

 // Create a new report for designing and previewing.

 if(bNew)

 {

  m_Application.CreateInstance("CrystalDesignRuntime.Application");

  m_Report = m_Application->NewReport();

 }

 // Show an Open dialog box, and then browse and open a report

 // for editing and previewing.

 else

 }

  // Initialize the Open dialog box to only display the

  // Crystal Report(.rpt) file type.

  CFileDialog FileDlg(TRUE,"*.rpt",NULL, OFN_EXPLORER, szFilter);

  // Show the Open dialog box

  int iReturn = FileDlg.DoModal();

  if(iReturn == IDOK)

  {

   // Get the name and path of the report file selected from the

   // Open dialog box.

   _bstr_t FileName(FileDlg.GetPathName().AllocSysString());

   // Create the Application Object.

   m_Application.CreateInstance("CrystalDesignRuntime.Application");

   // Open the report selected from the Open dialog box.

   m_Report = m_Application->OpenReport(FileName);

  }

  else if (iReturn = IDCANCEL)

  {

   // Terminate the execution of the function if the

   // user cancels.

   return;

  }

 }

 // Set the report object to the Embeddable Designer.

 m_Designer.SetReportObject(m_Report);

 // Set the report souce for the Crystal Reports Viewer

 m_Viewer.SetReportSource(m_Report);

 // Set the width of the report page to the width of the viewing area

 m_Viewer.Zoom(1);

 // View the report in the Crystal Reports Viewer control.

 m_Viewer.ViewReport();

 // Check if the Save Report button is enabled.

 // If the button is disabled then enable the Save Report,

 // and Preview buttons. The Save Report button will always

 // be enabled once the first report is opened or created.

 BOOL bEnabled;

 bEnabled = m_DesignerSettings.IsWindowEnabled();

 if( bEnabled == FALSE)

 {

  m_SaveReport.EnableWindow(TRUE);

  m_Preview.EnableWindow(TRUE);

 }

 // Check if the Embeddable Designer is hidden.

 // If it is hidden then hide the Design button, show the

 // Preview button, hide the Crystal Reports Viewer, and

 // show the Embeddable Designer.

 if(!m_Designer.IsWindowVisible())

 {

  m_ShowDesigner.ShowWindow(SW_HIDE);

  m_Preview.ShowWindow(SW_SHOW);

  m_Viewer.ShowWindow(FALSE);

  m_Designer.ShowWindow(TRUE);

 }

}

3	Add the code for the OnNewReport function.

// In this function call the InitReport function and pass a

// value of True to create a new report. Passing a value of

// False opens an existing report.

void CEmbeddable_DesignerDlg::OnNewReport()

{

 InitReport(TRUE);

}

4	Add the code for the OnOpenReport function.

// In this function call the InitReport function and pass

// a value of False to open an existing report. Passing a

// value of True creates a new report.

void CEmbeddable_DesignerDlg::OnOpenReport()

{

 InitReport(FALSE);

}

5	Add the code for the OnSaveReport function.

// In this function open a Save As dialog box and save the current

// report to the selected path and name.

void CEmbeddable_DesignerDlg::OnSaveReport()

{

 // Initialize the Save As dialog box to only display the Crystal

 // Report (.rpt) file type.

 CFileDialog FileDlg(FALSE,"*.rpt",NULL,OFN_EXPLORER, szFilter);

 // Show the Save As dialog box.

 int iReturn = FileDlg.DoModal();

 if(iReturn == IDOK)

 {

  // Get the path and name selected in the Save As dialog box.

  _bstr_t FileName(FileDlg.GetPathName().AllocSysString());

  // Save the report to the path and name specified in the

  // Save As dialog box.

  m_Designer.SaveReport(FileName);

 }

 else if(iReturn == IDCANCEL)

 {

  // Terminate the execution of the function if the

  // user cancels.

  return;

 }

}

6	Add the code for the OnPreview function

// In this function, refresh the report without refreshing the data

// source, hide the Preview button and the Embeddable Designer, and

// then show the Design button and the Crystal Report Viewer.

void CEmbeddable_DesignerDlg::OnPreview()

{

 m_Viewer.RefreshEx(FALSE);

 m_Preview.ShowWindow(SW_HIDE);

 m_Designer.ShowWindow(SW_HIDE);

 m_ShowDesigner.ShowWindow(SW_SHOW);

 m_Viewer.ShowWindow(SW_SHOW);

}

7	Add the code for the OnShowDesigner function.

// In this function, hide the Design button and the Crystal Report

// Viewer, and show the Preview button and the Embeddable Designer.

void CEmbeddable_DesignerDlg::OnShowDesigner()

{

 m_ShowDesigner.ShowWindow(SW_HIDE);

 m_Viewer.ShowWindow(SW_HIDE);

 m_Preview.ShowWindow(SW_SHOW);

 m_Designer.ShowWindow(SW_SHOW);

}

To continue with this procedure, go to Step 4: Running the Embeddable Designer application (Microsoft Visual C++).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 4: Running the Embeddable Designer application (Microsoft Visual C++)

To return to the previous part of this procedure, go to Step 3: Writing the code (Microsoft Visual C++).

In this step you will:

 	create and design a new report in the Embeddable Designer

 	view the report and any changes made to the report

 	open and edit an existing report in the Embeddable Designer

 	view the report and any changes made to the report

 	save a report.

1	With the application running, click New Report.

An empty report will appear in the Embeddable Designer.

Note: The interface for the Embeddable Designer is the same one used for ActiveX Designer reports created in the Microsoft Visual Basic IDE with the Report Designer Component.

2	Design a new report to view.

If you are not familiar with the designer environment, refer to Designing reports in the Embeddable Designer for a step-by-step procedure on creating a simple report off the Xtreme Sample Database ODBC data source.

3	Click Preview to view the report in the Crystal Report Viewer.

4	Click Design and make some changes to the report in the Embeddable Designer. Then click Preview to see the changes in the Crystal Report Viewer.

5	Click Open. In the Open dialog box, select one of the sample reports and click Open to view the report in the Embeddable Designer dialog.

6	Click Preview to view the report in the Crystal Report Viewer.

7	Click Design and make some changes to the report in the Embeddable Designer. Then click Preview to see the changes in the Crystal Report Viewer.

8	Click Save Report.

9	In the Save As dialog box, browse to the desired directory, type the name you want to save the report as, and then click Save.

Note: When you are designing a report the Preview button will be visible, and when you are previewing a report the Design button will be visible.

To return to the introduction, go to Creating a Microsoft Visual C++ sample application with the Embeddable Designer.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Designing reports in the Embeddable Designer

Designing reports in the Embeddable Designer is an easy, intuitive process. In this procedure, you will create a simple report off the Xtreme Sample Database ODBC data source, which installs with Crystal Reports. The report will include a text object, database fields, and a group.

The procedure contains the following steps:

 	Step 1: Adding a data source to the report

 	Step 2: Adding fields and grouping to the report

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 1: Adding a data source to the report

In this step, you will use the Data Explorer to add the Customer table from the ODBC data source Xtreme Sample Database.

1	On the Main Report tab, right-click Database Fields, and then click Add Database to Report.

2	In the Data Explorer dialog box, expand ODBC and expand Xtreme Sample Database; then select Customer, click Add, and click Close.

3	In the Visual Linking Expert dialog box, click OK.

The data source is now added to the report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Step 2: Adding fields and grouping to the report

In this step you will add a text object to the Report Header section, the Customer Name and Last Year’s Sales Fields to the Details section, and a group based on the Region field.

1	On the Main Report tab, right-click in the white space to access the shortcut menu.

2	On the shortcut menu, point to Insert, and then click Text Object.

An object frame appears with the Arrow pointer.

3	Drag the object frame to the Report Header section and click to release the text object.

4	Double-click the text object to edit it, and then type: Xtreme Sales Report by Region.

5	Expand Database Fields, and then expand Customer to view the database fields.

6	Drag the Customer Name and Last Year’s Sales fields into the Details section.

A column heading for each field is automatically placed in the Page Header section.

7	Click Insert Group on the toolbar.

8	In the Insert Group dialog box, select Region, and then click OK.

You are now ready to preview, export, print, or save the report. See Crystal Reports Online Help (Crw.chm) for more information on designing reports in the Crystal Reports environment.

Note: You can find the typical Crystal Report Designer commands (menu items and toolbar buttons) on the shortcut menu of the Embeddable Designer. The Embeddable Designer does not support the Chart Analyzer, Olap Grids, or Maps.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Working with Visual C++ and Visual InterDev

This section illustrates how the Report Designer Component (RDC) can be integrated using other development languages. Included are examples in Visual C++ and Visual Interdev.

Click the appropriate link to jump to that section:

 	Overview

 	Using the RDC with Visual C++

 	Using the RDC with Visual InterDev

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview

While much of this help system is aimed at the Visual Basic developer, it is important to note that the integration methods can be used in any environment that supports COM. This section shows you how to use different integration methods with other popular development environments.

Note: Visit the Seagate Software Developer Zone web site at http://www.seagatesoftware.com/products/dev_zone. Click Support to get links for finding documentation and knowledge base articles about the Report Designer Component.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using the RDC with Visual C++

There are different ways to access the Report Designer Component (RDC) and any other COM Automation server through Visual C++. This section describes how to use the #import method.

Manipulating the RDC in Microsoft Visual C++ involves three steps:

 	Define and instantiate a variable to be used to manipulate the RDC COM object.

 	Instantiate an actual instance of the RDC COM object and assign it to a variable.

 	Manipulate the Properties and Methods and then output the report.

The following section leads you through the details in each of these steps.

Printing a Report through Visual C++

To print a report through Visual C++:

1	Open Visual C++ 6.0 if it isn’t already running.

2	From the File menu, select New. In the New dialog box select the MFC AppWizard (exe) from the Projects tab. Type in MyRDC for the Project Name and click OK.

3	Click the Finish button to accept the defaults for the MFC AppWizard and then click OK in the New Project Information dialog box.

4	Add a reference to the RDC runtime object Model. From the File|Open menu select the StdAfx.h file that was generated by the MFC App wizard and Click Open. Add the following line after the #include directives:

#import "C:\Program Files\Seagate Software\Crystal Reports\Developer Files\include\craxdrt.tlb"

Note: This is the default location of the RDC runtime object model (craxdrt.dll).

5	Before you can invoke an RDC object, you must initialize OLE. From the File|Open menu, open the MyRDC.CPP file and add the following code:

struct InitOle {

InitOle()  { ::CoInitialize(NULL); }

~InitOle() { ::CoUninitialize();   }

} _init_InitOle_;

6	For optional Variant parameters declare a dummy variable in the MyRDC2.CPP class.

Variant dummy;

7	Add the following constants in the declaration’s of the MyRDC2.CPP class:

// The constants needed to create the Application and Report Objects COM objects

const CLSID CLSID_Application = {0xb4741fd0,0x45a6,0x11d1,{0xab,0xec,0x00,0xa0,0xc9,0x27,0x4b,0x91}};

const IID IID_IApplication = {0x0bac5cf2,0x44c9,0x11d1,{0xab,0xec,0x00,0xa0,0xc9,0x27,0x4b,0x91}};

const CLSID CLSID_ReportObjects = {0xb4741e60,0x45a6,0x11d1,{0xab,0xec,0x00,0xa0,0xc9,0x27,0x4b,0x91}};

const IID IID_IReportObjects = {0x0bac59b2,0x44c9,0x11d1,{0xab,0xec,0x00,0xa0,0xc9,0x27,0x4b,0x91}};

Opening and Printing a Crystal Report through the RDC

To open and print a Crystal Report through the RDC:

1	From the File|Open menu open the MyRDC.CPP file. Add the following code to the MyRDC.InitInstance() method just before the return statement:

// A dummy variant

VariantInit (&dummy);

dummy.vt = VT_EMPTY;

HRESULT            hr = S_OK;

              IApplicationPtr m_Application = NULL;

              IReportPtr m_Report = NULL;

              // Specify the path to the report you want to print

_bstr_t ReportPath("c:\\Program Files\\Seagate Software\\Crystal Reports\\Samples\\Reports\\General Business\\Inventory.rpt");

_variant_t vtEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);

// Instantiate the IApplication object

hr = CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER , IID_IApplication, (void **) & CRAXDRT::IApplication);

//Open the Report using the OpenReport method

m_Report = m_Application->OpenReport(ReportPath, dummy)

//Print the Report to printer

m_Report->PrintOut(dummy, dummy, dummy, dummy

);

2	Finally, from the Build menu, select Rebuild All.

There are hundreds of properties, methods, and events in the Report Designer Component object model that you can manipulate through your code to meet the demands of virtually any reporting requirement.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using the RDC with Visual InterDev

The following topics are directed at the developer of Web applications using the Report Integration Controls.

Installation

When you install Crystal Reports, the Report Integration Controls are installed in the folder SEAGATE SOFTWARE\SHARED\DESIGN TIME CONTROL by default. Initially, to set up the Report Integration Controls as Design Time Controls (DTC’s) for use in Visual InterDev 6.0, you need to:

1	Right-click in the Visual InterDev Toolbox. Choose Customize Toolbox from the shortcut menu.

2	In the Customize Toolbox dialog box, select the Design Time Controls tab. Check the two items ReportSource and ReportViewer.

The Report Integration Controls are comprised of the two DTC’s, ReportSource and ReportViewer. You will find that these two DTC’s are added to the Visual InterDev Toolbox. We will call them Report Source Control and Report Viewer Control below.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding Reports to the Current Project

You must first add a report to the current Visual InterDev project before you can apply any DTC’s to it.

Insert a Report Source Control (DTC)

When you insert a Report Source Control into your Web application, you actually create an instance of the Report Source Control. Its name is ReportSourcei, where i is the i-th instance of the Report Source Control, i=1,2,3…

When you right-click on an instance of a Report Source Control, you will invoke the Report Source Properties dialog box.

The properties you can specify for an instance of a Report Source Control include the following:

Attach a report to the Report Source Control

General information: In the General tab of the Report Source Properties dialog box, you may attach a report to this instance of the Report Source Control from the list of reports included in the current project.

Logon and test connectivity

Logon information for database: In the Accounts tab of the Report Source Properties dialog box, you can specify the server and database names for each of the tables used in the attached report, and test connectivity for each of these servers after entering the logon information.

If the report is hosted on a Web Reports Server, you may leave the logon information blank, which will in turn prompt the end user to enter the logon information. If the report is hosted on an ASP server, then you must enter the logon information.

Specify how to handle parameters

Parameters: In the Parameters tab of the Report Source Properties dialog box, if the report is hosted on a Web Reports Server, you may specify whether to prompt the end user to choose from a default list of values, or enter a value for a parameter.

However, if the report is hosted on an ASP server, then you must choose a value for each input parameter.

Specify selection formulas

Selection formula: In the Formula tab of the Report Source Properties dialog box, you may specify your own selections formulas, or to modify existing selection formulas.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Insert a Report Viewer control (DTC)

When you insert a Report Viewer Control into your Web application, you create an instance of the Report Viewer Control. Its name is ReportVieweri, where i is the i-th instance of the Report Viewer Control, i=1,2,3…

When you right-click on an instance of a Report Viewer Control, you will invoke the Report Viewer Properties dialog box.

Point the Viewer at the Report Source Control

The properties you can specify for an instance of a Report Viewer Control include:

General information: In the General tab of the Report Viewer Properties dialog box, you can select an instance of a Report Source Control and attach it to this instance of the Report Viewer Control. Upon clicking the Advanced button, you can specify a virtual path which is an alias to the directory of the Report Viewer Control.

Options for end users: In the Options tab of the Report Viewer Properties dialog box, you may specify the following for the end user:

 	The Report Viewer to use, whether it is the Report Viewer for Java or Report Viewer for ActiveX

 	The language to use for the Report Viewer, depending on the fonts installed on the current system

 	The size of the Report Viewer

 	The ability to refresh report in the Report Viewer

 	The ability to print report in the Report Viewer

 	The ability to export report from the Report Viewer

 	The ability to search in report in the Report Viewer

 	The ability to drill down in report in the Report Viewer

 	The ability to prompt on refresh of report in the Report Viewer

 	The ability to generate group tree in the Report Viewer

 	The ability to display group tree in the Report Viewer.

When you click OK, you’re finished.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Designer Component Object Model

The Report Designer Component is the ultimate development tool for your reporting needs. In this section you will find a detailed description of the Report Designer Component Object Model and its properties, methods and events.

Click the appropriate link to jump to that section:

 	Overview of the Report Designer Object Model

 	Unification of the RDC object model

 	Object Naming Conflicts

 	Objects and Collections

 	Application Object

 	Area Object

 	Areas Collection

 	BlobFieldObject Object

 	BoxObject ObjectCrossTabGroup Object

 	CrossTabGroups Collection

 	CrossTabObject Object

 	Database Object

 	DatabaseFieldDefinition Object

 	DatabaseFieldDefinitions Collection

 	DatabaseTable Object

 	DatabaseTables Collection

 	ExportOptions Object

 	FieldDefinitions Collection

 	FieldMappingData Object

 	FieldObject Object

 	FormattingInfo Object

 	FormulaFieldDefinition Object

 	GraphObject Object

 	GroupNameFieldDefinition Object

 	IFieldDefinition Object

 	IReportObject

 	LineObject Object

 	MapObject Object

 	ObjectSummaryFieldDefinitions Collection

 	OlapGridObject Object

 	OleObject Object

 	Page Object

 	PageEngine Object

 	PageGenerator Object

 	Pages Collection

 	ParameterFieldDefinition Object

 	ParameterFieldDefinitions Collection

 	PrintingStatus Object

 	Report Object

 	ReportObjects Collection

 	RunningTotalFieldDefinition Object

 	RunningTotalFieldDefinitions Collection

 	Section Object

 	Sections Collection

 	SortField Object

 	SortFields Collection

 	SpecialVarFieldDefinition Object

 	SQLExpressionFieldDefinition Object

 	SQLExpressionFieldDefinitions Collection

 	SubreportLink Object

 	SubreportLinks Collection

 	SubreportObject Object

 	SummaryFieldDefinition Object

 	SummaryFieldDefinitions Collection

 	TableLink Object

 	TableLinks Collection

 	TextObject Object

 	Enumerated Types

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview of the Report Designer Object Model

Please review the following comments regarding Object Naming Conflicts.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Unification of the RDC object model

Craxddrt.dll (Crystal Reports 8.5 ActiveX Designer Design and Runtime Library) is a new unified object model that combines the runtime capabilities of the Craxdrt.dll (Crystal Reports 8.5 ActiveX Designer Run Time Library) with the design time capabilities of the Craxddt.dll (Crystal Reports 8.5 ActiveX Designer Design Time Library). Craxddrt.dll will replace Craxddt.dll for versions 8.5 and up. Both the Craxddrt.dll and the Craxdrt.dll contain all the objects and associated methods, properties, and events needed for creating, opening, exporting, saving, and printing a report at run time. In addition, Craxddrt.dll is either used with the RDC ActiveX Designer when designing reports at design time, or used with the Embeddable Designer when designing reports at run time. See Embeddable Crystal Reports Designer Control Object Model for more information.

Note: The RDC ActiveX Designer is only available in Microsoft Visual Basic.

Prior to version 8.5, the Craxdrt.dll would be distributed with an application. Now the developer has a choice of two automation servers to distribute. Craxdrt.dll is backwards-compatible with previous versions and contains all the new features introduced in this version. Use the Craxdrt.dll for any client-side application that does not contain the Embeddable Designer, or use it for any server-side application. Craxddrt.dll is apartment-model threaded, but is not thread safe, and can only be used in a client-side application. Although the Craxddrt.dll is a fully functional automation server for the RDC, and can work in any client-side application, it will increase the install size. Therefore, it is recommended that you only use Craxddrt.dll with the Embeddable Crystal Reports Designer Control.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Object Naming Conflicts

If your project includes other libraries that contain objects named identical to those found in the Crystal Report Engine Object Library, you will encounter conflicts unless you reference the objects using a prefix. For example, if you have included the DAO Library with the Crystal Report Engine Object Library in your project, both libraries include a Database Object. In order to avoid conflicts, you must prefix the objects as follows:

CRAXDRT.Database

for the Crystal Report Engine Object Library, or

DAO.Database

for the DAO Library.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Objects and Collections

The following Objects and Collections, listed alphabetically, are discussed in this section. Properties, Methods and Events are listed under the appropriate Object or Collection.

Note: Some of the new report creation calls are not included in the free runtime license included with Crystal Reports. For a list of calls that require additional licensing, please see the Royalty help file (Royalty Required Runtime.hlp).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Application Object

An instance of the Application object can be created using the Visual Basic New keyword or the CreateObject function and the Prog Id CrystalRuntime.Application.[8]. For example:

 	Using the New keyword

Dim app as New CRAXDRT.Application

Set app = New CRAXDRT.Application

Or,

’Automatically creates a new instance of the object when it is first

’referenced in the code, so it doesn’t have to be set.

Dim app as New Application

 	Using the CreateObject function

’If the version number of the application is not specified, CreateObject will

’create an application running against the new version of craxdrt.dll

Dim app As Application

Set app = CreateObject("CrystalRuntime.Application")

Or,

’Specify the version number to require version 8 of the dll.

Dim app As Application

Set app = CreateObject("CrystalRuntime.Application.8")

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Application Object Methods

The following methods are discussed in this section:

CanClose Method (Application Object)

GetVersion Method (Application Object)

LogOffServer Method (Application Object)

LogOnServer Method (Application Object)

LogOnServerEx Method (Application Object)

NewReport Method (Application Object)

OpenReport Method (Application Object)

SetMatchLogOnInfo Method (Application Object)

SetMorePrintEngineErrorMessages Method (Application Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CanClose Method (Application Object)

The CanClose method indicates whether or not the Application Object can be destroyed. This method will return FALSE as long as there are valid Report objects in existence and at least one Report Object is in the printing-in-progress state. The Application object can only be destroyed if no instances of the Report Object are in the printing-in-progress state. If you obtain a Report object directly from the Report Designer Component added to your project at design time, then CanClose will always return False until you destroy that object (usually by setting it equal to Nothing).

Syntax

Function CanClose () As Boolean

Returns

 	TRUE if the Engine can be closed.

 	FALSE if the Engine is busy.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetVersion Method (Application Object)

The GetVersion method returns an integer that, when converted to hex, represents the version number of the dll.

Syntax

Function GetVersion () As Integer

Returns

 	Returns an integer that represents the version number of the dll when converted to hexidecimal.

Sample

’Display the version number in a text box.

Text1.text = Hex(CRXApplication.GetVersion)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


LogOffServer Method (Application Object)

The LogOffServer method logs off an SQL server or other data sources such as ODBC or OleDB provider. Use this method when you have logged on to the data source using LogOnServer Method (Application Object). This method is only valid if you have purchased Crystal Reports 6.0 or later.

Syntax

Sub LogOffServer (pDllName As String, pServerName As String,

    [pDatabaseName], [pUserID], [pPassword])

Parameters

Parameter
Description
pDLLName
Specifies the name of the DLL for the server or password protected non-SQL table you want to log on to, for example "PDSODBC.DLL". Note that the DLLName must be enclosed in quotes. DLL names have the following naming convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/ODBC databases.
pServerName
Specifies the log on name for the server used to create the report. (For ODBC, use the data source name.) This value is case-sensitive. See Remarks below.
[pDatabaseName]
Specifies the name for the database used to create the report. See Remarks below.
[pUserID]
Specifies the User ID number necessary to log on to the server. See Remarks below.
[pPassword]
Specifies the password necessary to log on to the server.
Remarks

 	For parameters pServerName, pDatabaseName, and pUserId, pass an empty string ("") to preserve the existing setting or pass a non-empty string (for example, "Server A") to override a value that is already set in the report.

 	If you try to log off a server that is still in use (i.e., there is an object variable still in focus that holds reference to a report that requires being logged on to the server to access data) you will be unable to log off. This will apply to every object that comes from the Report Object, as they all hold reference to the report through their respective Report properties.

 	If you assign the Report object to the ReportSource property of the CRViewer Object (CRVIEWERLib), in the Crystal Reports Report Viewer, enabling the report to be displayed through the Report Viewer, you cannot call LogOffServer for the report until you assign a new report to the Report Viewer or close the CRViewer object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


LogOnServer Method (Application Object)

The LogOnServer method logs on to an SQL server or other data sources such as ODBC. Once logged on using this method, you will remain logged on until you call LogOffServer Method (Application Object), or until the Application Object, is destroyed and craxdrt.dll is unloaded. This method is only valid if you have purchased Crystal Reports 6.0 or later.

Syntax

Sub LogOnServer (pDllName As String, pServerName As String,

    [pDatabaseName], [pUserID], [pPassword])

Parameters

Parameter
Description
pDLLName
Specifies the name of the DLL for the server or password protected non-SQL table you want to log on to, for example "PDSODBC.DLL". Note that the dllName must be enclosed in quotes. DLL names have the following naming convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/ODBC databases.
pServerName
Specifies the log on name for the server used to create the report. (For ODBC, use the data source name.) This value is case-sensitive. See Remarks below.
[pDatabaseName]
Specifies the name for the database used to create the report. See Remarks below.
[pUserID]
Specifies the User ID number necessary to log on to the server. See Remarks below.
[pPassword]
Specifies the password necessary to log on to the server.

*When you pass an empty string ("") for this parameter, the program uses the value that’s already set in the report. If you want to override a value that’s already set in the report, use a non-empty string (i.e., "Server A").

Remarks

For parameters pServerName, pDatabaseName, and pUserId, pass an empty string ("") to preserve the existing setting or pass a non-empty string (for example, "Server A") to override a value that is already set in the report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


LogOnServerEx Method (Application Object)

The LogOnServer method logs on to an SQL server or other data sources such as ODBC. Using LogOnServerEx, you can pass server type or connection information. Once logged on using this method, you will remain logged on until you call LogOffServer Method (Application Object), or until the Application Object, is destroyed and craxdrt.dll is unloaded. This method is only valid if you have purchased Crystal Reports 6.0 or later.

Syntax

Sub LogOnServerEx (pDllName As String, pServerName As String,

    [pDatabaseName], [pUserID], [pPassword],

    [pServerType], [pConnectionString])

Parameters

Parameter
Description
pDLLName
Specifies the name of the DLL for the server or password protected non-SQL table you want to log on to, for example "PDSODBC.DLL". Note that the dllName must be enclosed in quotes. DLL names have the following naming convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/ODBC databases.
pServerName
Specifies the log on name for the server used to create the report. (For ODBC, use the data source name.) This value is case-sensitive. See Remarks below.
[pDatabaseName]
Specifies the name for the database used to create the report. See Remarks below.
[pUserID]
Specifies the User ID number necessary to log on to the server. See Remarks below.
[pPassword]
Specifies the password necessary to log on to the server.
[pServerType]
Specifies the database Server Type.
[pConnectionString]
Specifies the connection string.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


NewReport Method (Application Object)

The NewReport method creates a new empty Report Object.

Syntax

Function NewReport () As Report

Returns

 	Returns a new empty Report Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OpenReport Method (Application Object)

The OpenReport method opens an existing report file, creating an instance of the Report object. Through the Report Object, you can change formatting, formulas, selection formulas, and sort fields for the report, then print, preview, or export the report.

Syntax

Function OpenReport (pFileName As String, [OpenMethod]) As Report

Parameters

Parameter
Description
pFileName
Specifies a string value indicating the file name and path of the report that you want to open.
OpenMethod
Specifies whether you want to open the report exclusively. If you do not provide this parameter the report is opened exclusively and cannot open it a second time.
Returns

 	Returns an instance of the Report Object, if the report was successfully opened.

 	Returns 0 if the report file does not exist or if an error occurs.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetMatchLogOnInfo Method (Application Object)

The SetMatchLogOnInfo Method sets global match log on info option, matching the log on password.

Syntax

Sub SetMatchLogOnInfo (bl As Boolean)

Parameter

Parameter
Description
bl
Specifies whether the option is selected (TRUE).
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetMorePrintEngineErrorMessages Method (Application Object)

Use the SetMorePrintEngineErrorMessages method to set the global more print engine error messages option.

Syntax

Sub SetMorePrintEngineErrorMessages (bl As Boolean)

Parameter

Parameter
Description
bl
Specifies whether the option is selected (TRUE)
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Area Object

The Area Object represents an area in a report. An area is a group of like sections in the report (i.e., Details A - Da, Details B - Db, etc.) that all share the same characteristics. Each section within the area can be formatted differently. This object allows you to retrieve information and set options for a specified area in your report.

Area Object Properties

Property
Description
Read/Write
Restriction in event handler
CopiesToPrint
Integer. Gets or sets the number of copies of each item in the Details section of the report. For example, by default, each line of the Details section only prints once. By setting this to 3, each line of the Details section would print 3 times.
Read/Write
Can be written only when formatting idle.
DetailHeight
Long. Gets the mailing label report deatil area height, in twips.
Read only
None
DetailWidth
Long. Gets multiple column report detail area width, in twips.
Read only
None
DiscardOther
Groups
Boolean. Gets or sets the discard other groups option.
Read/Write
Enable
Hierarchical
GroupSorting
Boolean. Gets or sets group hierarchically flag.
Read/Write
Fromatting idle.
GroupCondition
CRGroupCondition
. Gets or sets the group condition.
Read/Write
Can be written only when formatting idle.
GroupCondition
Field
Object. Gets or sets the group condition field.
Read/Write
Can be written only when formatting idle.
GroupIndent
Long. Gets or sets group indent, in twips.
Read/Write
Fromatting idle.
GroupNumber
Integer. If the area is a group area, this returns the group number. Otherwise, exception is thrown.
Read only
None
HideFor
DrillDown
Boolean. Gets or sets hide for drill down option.
Read/Write
Can be written only when formatting idle.
HorizontalGap
Long. Gets the horizontal gaps going across page in a multiple column report.
Read only
None
InstanceIDField
IFieldDefinition Object
. Gets the instance ID field
Read only
Fromatting idle.
KeepGroup
Together
Boolean. Gets or sets the keep group together option.
Read/Write
Can be written only when formatting idle.
KeepTogether
Boolean. Gets or sets the keep area together option.
Read/Write
Can be written only when formatting idle.
Kind
CRAreaKind
. Gets which kind of area (for example, Details, Report Header, Page Footer, etc.).
Read only
None
Name
String. Gets or sets the area name.
Read/Write
Can be written only when formatting idle.
NewPageAfter
Boolean. Gets or sets the new page after options.
Read/Write
Can be written only when formatting idle.
NewPageBefore
Boolean. Gets or sets the new page before option.
Read/Write
Can be written only when formatting idle.
NumberOfTop
OrBottomN
Groups
Integer. Gets or sets the number of top or bottom groups.
Read/Write
Formatting idle.
Parent
Report Object
. Gets reference to the parent object.
Read Only
None
ParentIDField
IFieldDefinition Object
. Gets the parent ID field.
Read only
Formatting idle.
PrintAtBottom
OfPage
Boolean. Gets or sets the print at bottom of page option.
Read/Write
Can be written only when formatting idle.
RepeatGroup
Header
Boolean. Gets or sets the repeating group header option.
Read/Write
Can be written only when formatting idle.
ResetPage
NumberAfter
Boolean. Gets or sets the reset page number after option.
Read/Write
Can be written only when formatting idle.
Sections
Sections Collection
. Gets a Collection of all the sections in the area.
Read Only
None
SortDirection
CRSortDirection
. Gets or sets the group sort direction.
Read/Write
Can be written only when formatting idle.
Suppress
Boolean. Gets or sets the area visibility.
Read/Write
Can be written only when formatting idle.
TopOrBottom
NGroupSort
Order
CRTopOrBottomNGroupSortOrder
. Gets or sets the top or bottom N group sort order.
Read/Write
Formatting idle.
TopOrBottom
NSortField
SummaryFieldDefinition Object
. Gets or sets the top or bottom n sort field.
Read/Write
Formatting idle.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Area Object Methods

The following methods are discussed in this section:

SetInstanceIDField Method (Area Object)

SetParentIDField (Area Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetInstanceIDField Method (Area Object)

Use SetInstanceIDField method to set an instance ID field.

Syntax

Sub SetInstanceIDField (InstanceIDField)

Parameter

Parameter
Description
InstanceIDField
Specifies the instance ID field that you want to set.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetParentIDField (Area Object)

Use SetParentIDField method to set the parent ID field.

Syntax

Sub SetParentIDField (ParentIDField)

Parameter

Parameter
Description
ParentIDField
Specifies the parent ID field that you want to set.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Areas Collection

The Areas Collection contains the area objects for every area in the report. Access a specific Area Object,  in the collection using the Item property.

Areas Collection Properties

Property
Description
Read/Write
Restriction in event handler
Count
Long. Gets the number of areas in the collection.
Read only
None
Item (index)
Area Object
. Gets an item from the Collection. Item has an index parameter that can be either a string reference to the area (for example, "RH", "PH", "GHn", "D", "GFn", "PF", or "RF") or a numeric, 1-based index (for example, Item (1) for the Report Header area). The items in the collection are indexed in the order they are listed for each section/area.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference an area directly (for example, Areas("RH") or Areas(1)).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


BlobFieldObject Object

The BlobFieldObject Object allows you to get and set information for bitmap database fields in a report.

BlobFieldObject Object Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomCropping
Long. Gets or sets bottom cropping size, in twips.
Read/Write
Can be written only when formatting idle.
BottomLineStyle
CRLineStyle
. Gets or sets the bottom line style.
Read/Write
Can be written only when formatting idle or active.
CloseAtPageBreak
Boolean. Gets or sets the close border on page break.
Read/Write
Can be written only when formatting idle or active.
Field
DatabaseFieldDefinition Object
. Gets the database field definition object containing information about the BLOB field.
Read only
None
HasDropShadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets the object height, in twips.
Read/Write
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets CRObjectKind which specifies the kind of object (for example, box, cross-tab, field, etc.).
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftCropping
Long. Gets or sets the left cropping size, in twips.
Read/Write
Can be written only when formatting idle.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
RightCropping
Long. Gets or sets the right cropping size, in twips.
Read/Write
Can be written only when formatting idle.
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopCropping
Long. Gets or sets the top cropping size, in twips.
Read/Write
Can be written only when formatting idle.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets or sets the object width, in twips.
Read/Write
Can be written only when formatting idle or active.
XScaling
Double. Gets or sets the width scaling factor. For example, 1 means 100%, 2 means 200%, 0.5 means 50% etc. The scaling factor may range from 0.01 to 100.
Read/Write
Can be written only when formatting idle.
YScaling
Double. Gets or sets the height scaling factor. For example, 1 means 100%, 2 means 200%, 0.5 means 50% etc. The scaling factor may range from 0.01 to 100.
Read/Write
Can be written only when formatting idle.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


BoxObject Object

The Box Object represents a box that has been drawn on the report. This object allows you to get information about boxes in a report.

BoxObject Object Properties

Property
Description
Read/Write
Restriction in event handler
Bottom
Long. Gets or sets the object lower bottom position, in twips.
Read/Write
Can be written only when formatting idle.
BottomRightSection
Section Object
. Gets the bottom right section.
Read only
Can be written only when formatting idle.
CloseAtPageBreak
Boolean. Gets or sets the close border on page break option.
Read/Write
Can be written only when formatting idle.
CornerEllipseHeight
Long. Gets or sets the corner elipse height, in twips.
Read/Write
CornerEllipseWidth
Long. Gets or sets the corner elipse width, in twips.
Read/Write
ExtendToBottomOf
Section
Boolean. Gets or sets the extend to bottom of section option.
Read/Write
Can be written only when formatting idle.
FillColor
OLE_COLOR. Gets or sets the fill color.
Read/Write
Can be written only when formatting idle.
HasDropShadow
Boolean. Gets or sets the border drop shadow option..
Read/Write
Can be written only when formatting idle.
Kind
CRObjectKind
. Gets  which kind of object (for example, box, cross-tab, field, etc.).
Read only
None
Left
Long. Gets or sets the upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LineColor
OLE_COLOR. Gets or sets the line color.
Read/Write
Can be written only when formatting idle.
LineStyle
CRLineStyle
. Gets or sets the line style.
Read/Write
Can be written only when formatting idle.
LineThickness
Long. Gets or sets the line thickness, in twips.
Read/Write
Can be written only when formatting idle.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
Right
Long. Gets or sets the object lower right position, in twips.
Read/Write
Can be written only when formatting idle.
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CrossTabGroup Object

The CrossTabGroup Object contains information related to CrossTabGroups in a report.

CrossTabGroup Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the crosstab group background color.
Read/Write
Idle
Condition
CRGroupCondition
. Gets or sets the crosstab group condition.
Read/Write
Idle
EnableSuppress
Label
Boolean. Gets or sets the crosstab group enable suppress label option.
Read/Write
Idle
EnableSuppress
Subtotal
Boolean. Gets or sets the crosstab group enable suppress subtotal option.
Read/Write
Idle
Field
IFieldDefinition Object
. Gets or sets the crosstab group’s field.
Read/Write
Idle
Parent
CrossTabObject Object
. Gets reference to the crosstab group parent object.
Read only
None
SortDirection
CRSortDirection
. Gets or sets the crosstab group sort direction.
Read/Write
Idle
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CrossTabGroups Collection

The CrossTabGroups Collection contains CrossTabGroup Objects associated with a report.

CrossTabGroups Collection Properties

Property
Description
Read/Write
Restriction in event handler
Count
Long. Gets the CrossTabGroup count.
Read only
None
Item
(index As Long)
CrossTabGroup Object
. Gets an item from the Collection.
Read only
None
Parent
CrossTabObject Object
. Gets reference to the parent object.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CrossTabGroups Collection Methods

The following methods are discussed in this section:

Add Method (CrossTabGroups Collection)

Delete Method (CrossTabGroups Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (CrossTabGroups Collection)

Use the Add method to add a field as a CrossTabGroup to the CrossTabGroups Collection.

Syntax

Function Add (Field) As CrossTabGroup

Parameter

Parameter
Description
Field
Specifies the field that you want to add as a CrossTabGroup to the Collection.
Returns

Returns a CrossTabGroup Object member of the Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (CrossTabGroups Collection)

Use Delete method to remove a CrossTabGroup Object from the Collection.

Syntax

Sub Delete (index As Long)

Parameter

Parameter
Description
index
Specifies the index of the CrossTabGroup Object that you want to delete from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CrossTabObject Object

The CrossTabObject Object allows you to get and set information for cross-tab objects in a report.

CrossTabObject Object Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomLineStyle
CRLineStyle
. Gets or sets the bottom line style.
Read/Write
Can be written only when formatting idle or active.
CloseAtPageBreak
Boolean. Gets or sets the close border on page break option.
Read/Write
Can be written only when formatting idle or active.
ColumnGrandTotal
Color
OLE_COLOR. Gets or sets the column grand total color.
Read/Write
Idle
ColumnGroups
CrossTabGroups Collection
. Gets the column groups Collection.
Read only
None
EnableKeep
ColumnsTogether
Boolean. Gets or sets the enable keep columns together option.
Read/Write
Idle
EnableRepeatRow
Labels
Boolean. Gets or sets the enable repeat row labels option.
Read/Write
Idle
EnableShowCell
Margins
Boolean. Gets or sets the enable show cell margins option.
Read/Write
Idle
EnableShowGrid
Boolean. Gets or sets the enable show grid option.
Read/Write
Idle
EnableSuppress
ColumnGrand
Totals
Boolean. Gets or sets the enable suppress column grand totals option.
Read/Write
Idle
EnableSuppress
EmptyColumns
Boolean. Gets or sets the enable suppress empty columns option.
Read/Write
Idle
EnableSuppress
EmptyRows
Boolean. Gets or sets the enable suppress empty rows option.
Read/Write
Idle
EnableSuppress
RowGrandTotals
Boolean. Gets or sets the enable suppress row grand totals option.
Read/Write
Idle
HasDropShadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets the object height, in twips.
Read only
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets which kind of object (for example, box, cross-tab, field, etc.).
Read only
None
Left
Long. Gets or sets the upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
RowGrandTotal
Color
OLE_COLOR. Gets or sets the row grand total color.
Read/Write
Idle
RowGroups
CrossTabGroups Collection
. Gets the row groups Collection.
Read Only
None
SummaryFields
ObjectSummaryFieldDefinitions Collection
. Gets the summary fields.
Read Only
None
Suppress
Boolean. Gets or sets the object visibility option.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopLineStyle
CRLineStyle
. Gets or sets top line style.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets the object width, in twips.
Read Only
Can be written only when formatting idle or active.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Database Object

The Database Object provides properties to get information about the database accessed by a report. See Overview of the Report Designer Object Model.

Database Object Properties

Property
Description
Read/Write
Restriction inevent handler
Links
TableLinks Collection
. Gets database link collection.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Tables
DatabaseTables Collection
. Gets the DatabaseTables Collection which specifies the database objects used in the report (for example, an Access report may contain a query or a SQL Server report may be based on a stored procedure - if so, they will be returned as part of this collection along with the database table used in the report).
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Database Object Methods

The following methods are discussed in this section:

AddADOCommand Method (Database Object)

AddOLEDBSource Method (Database Object)

ConvertDatabaseDriver Method (Database Object)

LogOffServer Method (Database Object)

LogOnServer Method (Database Object)

LogOnServerEx Method (Application Object)

SetDataSource Method (Database Object)

Verify Method (Database Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddADOCommand Method (Database Object)

Use AddADOCommand method to add a database table to your report through an ADO connection and command.

Syntax

Sub AddADOCommand (pConnection, pCommand)

Parameters

Parameter
Description
pConnection
Specifies the ADO connection that you want to use.
pCommand
Specifies the ADO command that you want to use.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddOLEDBSource Method (Database Object)

Use AddOLEDBSource method to add a database table to your report through an OLE DB provider.

Syntax

Sub AddOLEDBSource (pConnectionString As String, pTableName As String)

Parameters

Parameter
Description
pConnectionString
Specifies the connection string for the OLE DB provider.
pTableName
Specifies the OLE DB database table that you want to add to your report.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ConvertDatabaseDriver Method (Database Object)

Use ConvertDatabaseDriver to convert the database driver DLL used by the report.

Syntax

Sub ConvertDatabaseDriver (pDLLName As String, blDoImmediateConvert as Boolean)

Parameters

Parameter
Description
pDllName
Specifies the new DLL for the database driver.
blDoImmediateConvert
Specifies when the database driver will be converted. If True, the database driver is converted when the report is previewed, or the when the database is verified. If False, the database driver is converted when the report is refreshed in the preview window.
Remarks

 	Set blDoImmediate to False when you want the user to be prompted for the data source information. This applies to reports that are previewed and refreshed in the Crystal Report Viewer, and to reports that are exported or saved to a Crystal Report format (.rpt), and previewed and refreshed in the Crystal Reports Designer. When the report is previewed, a dialog box for the new data source appears. For example, converting to ODBC (P2sodbc.dll) opens the Set Data Source dialog box, while converting to OLEDB (P2soledb.dll) opens the Data Link Properties dialog box.

 	Set blDoImmediateConvert to True when you want to set the data source at runtime. Additional code must be added to set the logon information for the data source, and to verify the database. One exception is converting to OLEDB (P2soledb.dll). Since there is no method to set the provider at runtime the Data Links dialog box will always prompt for the data source. In this case only the code to convert the databse driver is required.

 	Once the database is converted, and the data source is set, either through code, or through a dialog box, three additional prompts may appear:

 	Logon to the data source

This dialog box allows you to log on to the correct data source. If the data source is not secured, you can click OK without entering any logon information.

 	Verify the database

This is a message warning the user that the database file has changed and the report is being updated.

 	Map the fields.

This dialog box allows you to map the fields that have changed with the new data source. For more information on mapping fields see "Re-mapping altered database fields" in the Crystal Reports Online Help (Crw.chm).

Sample

The following code demonstrates how to convert the database driver to ODBC (P2sodbc.dll) using the ConverDataBaseDriver method. The ODBC data source is pointing to a Microsoft Access database.

'Instantiate the report object.

Set m_Report = New CrystalReport1

' Convert the database driver to ODBC.

m_Report.Database.ConvertDatabaseDriver "p2sodbc.dll", True

' Set the logon information for the ODBC data source.

' If the logon information is not set an error will be produced when the

' report is previewed or exported.

m_Report.Database.Tables(1).SetLogOnInfo "Xtreme Sample Database", "", "", ""

' Verify the database.

' If the database is not verified before exporting an error will be produced.

' If the database is not verified before previewing the report, the user may be

' prompted when the report is refreshed in the Crystal Report Viewer.

m_Report.Database.Verify

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


LogOffServer Method (Database Object)

The LogOffServer method logs off an SQL server, ODBC or other data source. Use this method when you have logged on to the data source using LogOnServer. This method can be invoked only in formatting Idle mode.

Syntax

Sub LogOffServer (pDllName As String, pServerName As String,

    [pDatabaseName], [pUserID], [pPassword])

Parameters

Parameter
Description
pDllName
Specifies the name of the DLL for the server or password protected non-SQL table you want to log on to, for example "PDSODBC.DLL". Note that the dllName must be enclosed in quotes. DLL names have the following naming convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/ODBC databases.
pServerName
Specifies the log on name for the server used to create the report. For ODBC, use the data source name. This value is case-sensitive. See Remarks below.
[pDatabaseName]
Specifies the name for the database used to create the report. See Remarks below.
[pUserID]
Specifies the User ID number necessary to log on to the server. See Remarks below.
[pPassword]
Specifies the password necessary to log on to the server.
Remarks

 	When you pass an empty string ("") for pServerName, pDatabaseName, or pUserID, the program uses the value that's already set in the report. If you want to override a value that's already set in the report, use a non-empty string (for example, "Server A").

 	If you try to log off a server that is still in use (that is, there is an object variable still in focus that holds reference to a report that requires being logged on to the server to access data) you will be unable to log off. This will apply to every object that comes from the Report Object, as they all hold reference to the report through their respective Report properties.

 	If you assign the Report object to the ReportSource property of the CRViewer Object (CRVIEWERLib), in the Crystal Reports Report Viewer, enabling the report to be displayed through the Report Viewer, you cannot call LogOffServer for the report until you assign a new report to the Report Viewer or close the CRViewer object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


LogOnServer Method (Database Object)

The LogOnServer method logs on to an SQL server, ODBC or other data source. Once logged on using this method, you will remain logged on until you call LogOffServer or until the Application Object is destroyed and craxdrt.dll is unloaded. This method can be invoked only in formatting Idle mode.

Syntax

Sub LogOnServer (pDllName As String, pServerName As String,

    [pDatabaseName], [pUserID], [pPassword])

Parameters

Parameter
Description
pDllName
Specifies the name of the DLL for the server or password protected non-SQL table you want to log on to, for example "PDSODBC.DLL". Note that the dllName must be enclosed in quotes. DLL names have the following naming convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/ODBC databases.
pServerName
Specifies the log on name for the server used to create the report. For ODBC, use the data source name. This value is case-sensitive. See Remarks below.
[pDatabaseName]
Specifies the name for the database used to create the report. See Remarks below.
[pUserID]
Specifies the User ID number necessary to log on to the server. See Remarks below.
[pPassword]
Specifies the password necessary to log on to the server.
Remarks

When you pass an empty string ("") for this parameter, the program uses the value that's already set in the report. If you want to override a value that's already set in the report, use a non-empty string (for example, "Server A").

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


LogOnServerEx Method (Database Object)

The LogOnServerEx method logs on to an SQL server, ODBC or other data source. Using this method, you can pass ServerType and ConnectionString info. Once logged on using this method, you will remain logged on until you call LogOffServer or until the Application Object is destroyed and craxdrt.dll is unloaded. This method can be invoked only in formatting Idle mode.

Syntax

Sub LogOnServerEx (pDllName As String, pServerName As String,

    [pDatabaseName], [pUserID], [pPassword],

    [pServerType], [pConnectionString])

Parameters

Parameter
Description
pDllName
Specifies the name of the DLL for the server or password protected non-SQL table you want to log on to, for example "PDSODBC.DLL". Note that the dllName must be enclosed in quotes. DLL names have the following naming convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/ODBC databases.
pServerName
Specifies the log on name for the server used to create the report. For ODBC, use the data source name. This value is case-sensitive. See Remarks below.
[pDatabaseName]
Specifies the name for the database used to create the report. See Remarks below.
[pUserID]
Specifies the User ID number necessary to log on to the server. See Remarks below.
[pPassword]
Specifies the password necessary to log on to the server.
[pServerType]
Specifies the database Server Type.
[pConnectionString]
Specifies the connection string.
Remarks

When you pass an empty string ("") for this parameter, the program uses the value that's already set in the report. If you want to override a value that's already set in the report, use a non-empty string (for example, "Server A").

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetDataSource Method (Database Object)

The SetDataSource method is used to provide information about a data source to the database driver associated with this Database object at runtime. For instance, if a report has been designed using the Crystal Active Data Driver this method can be used to provide an active data source for the report, such as a DAO, ADO, or RDO Recordset or a CDO Rowset. In this case, the object passed to the second parameter of this method replaces, at runtime, the field definition file used to create the report. This method can be invoked only in formatting Idle mode.  When using a secure connection such as SQL Server, some additional code is required (see Remarks below).

Syntax

Sub SetDataSource (data, [dataTag], [tableNumber])

Parameters

Parameter
Description
data
Variant data passed to the database driver. For example, with Active data, this must be a Recordset object if you are using DAO, ADO, or the Visual Basic data control. This must be a Rowset object if you are using CDO.
[dataTag]
A value indicating the type of data being passed to the DatabaseTable object in the Data parameter. Currently, the only possible value is 3. This value must be used for all Active data sources including DAO, ADO, RDO, CDO, and the Visual Basic data control.
[tableNumber]
Specifies the index number of the table to be set. Default value = 1.
Remarks

 	When the data source uses a secure connection, such as SQL Server, additional information must be passed in the "form load" event before the call to view the report. For example,

DataEnvironment1.Command1

Report.Database.SetDataSource (DataEnvironment1.rsCommand1)

 	SetDataSource method is used to set a datasource at runtime. If the report is initially created and then saved, and then later run using either the RDC or CRW, the runtime datasource (DAO, ADO, or RDO Recordset) cannot be recreated. The user will not be able to run or preview the report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Verify Method (Database Object)

The Verify method verifies that the location of the database is still valid and checks to see if any changes have been made to table design, etc. If there are any changes to the database, the Verify method will update the report automatically to reflect these changes. See Remarks below. This method can be invoked only in formatting Idle mode.

Syntax

Sub Verify ()

Remarks

Prior to calling Verify, you can use the CheckDifferences Method (DatabaseTable Object) to determine what kind of differences, if any, exist between the report table and the physical table. pDifferences parameter of CheckDifferences method will pass back one or more bitwise (XOR’d) CRTableDifferences enums indicating the information that you want to retrieve.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DatabaseFieldDefinition Object

The DatabaseFieldDefinition Object represents a database field used in the report. This object provides properties for getting information on database fields in the report.

DatabaseFieldDefinition Object Properties

Property
Definition
Read/Write
Restriction in
event handler
DatabaseFieldName
String. Specifies the name of the field in the database (for example, Product ID).
Read only
None
Kind
CRFieldKind
. Gets which kind of field (for example, database, summary, formula, etc.).
Read only
None
Name
String. Gets the unique Crystal formula form name of the field within the report as {table.FIELD} (for example, {product.PRODUCT ID}).
Read only
None
NextValue
Variant. Gets the field next value.
Read only
Can be read only when top-level Report object is formatting active.
NumberOfBytes
Integer. Gets the number of bytes required to store the field data in memory.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PreviousValue
Variant. Gets the field previous value.
Read only
Can be read only when top-level Report object is formatting active.
TableAliasName
String. Gets the alias for the table containing the field.
Read only
Can be written only when formatting idle.
Value
Variant. Gets the field current value.
Read only
Can be read only when top-level Report object is formatting active.
ValueType
CRFieldValueType
. Gets which type of value is found in the field.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DatabaseFieldDefinitions Collection

The DatabaseFieldDefinitions Collection is a collection of database field definition objects. One object exists in the collection for every database field accessed by the report. Access a specific DatabaseFieldDefinition Object in the collection using the Item property.

DatabaseFieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of
DatabaseFieldDefinition Object
, in the collection.
Read only
None
Item (index
As Long)
DatabaseFieldDefinition Object
. Item has an index parameter that is a numeric, 1-based index for the object that you want to retrieve (for example, Item (1) for the first database field in the collection). The items in the collection are indexed in the order they appear in the database table.
Read only
None
Parent
DatabaseTable Object
. Reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a database directly (for example, DatabaseFieldDefintion(1)).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DatabaseTable Object

The DatabaseTable Object refers to a database table accessed by the report.

DatabaseTable Object Properties

Property
Description
Read/Write
Restriction in
event handler
ConnectBuffer
String
String. Gets the table connect buffer string.
Read only
None
DatabaseType
CRDatabaseType
. Gets the database table type
Read only
DescriptiveName
String. Gets the table descriptive name.
Read only
None
DllName
String. Gets the table driver DLL name.
Read only
None
Fields
DatabaseFieldDefinitions Collection
. Gets the collection of database fields in the table.
Read only
None
Location
String. Gets or sets the location of the database table.
Read/Write
Can be written only when formatting idle.
LogOnDatabase
Name
String. Gets the logon database name.
Read only
None
LogOnServerName
String. Gets the logon server name.
Read only
None
LogOnUserID
String. Gets the logon user ID.
Read only
None
Name
String. Gets or sets the alias name for the database table used in the report.
Read/Write
Can be written only when formatting idle.
Parent
Database Object
. Reference to the parent object.
Read only
None
SessionUserID
String. Gets the session user ID.
Read only
None
SubLocation
String. Gets the table sublocation.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DatabaseTable Object Methods

The following methods are discussed in this section:

CheckDifferences Method (DatabaseTable Object)

SetDataSource Method (DatabaseTable Object)

SetLogOnInfo Method (DatabaseTable Object)

SetSessionInfo Method (DatabaseTable Object)

SetTableLocation Method (DatabaseTable Object)

TestConnectivity Method (DatabaseTable Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CheckDifferences Method (DatabaseTable Object)

Use CheckDifferences method to determine what kind(s) of differences were found between the report table and the physical table.

Syntax

Sub CheckDifferences (pDifferences As Long, [reserved])

Parameters

Parameter
Description
pDifferences
CRTableDifferences
. Bitwise constants specify the table difference(s) (XOR’d), if any.
[reserved]
Reserved. Do not use.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetDataSource Method (DatabaseTable Object)

The SetDataSource method is used to provide information about a data source to the database driver associated with this DatabaseTable object at runtime. For instance, if a report has been designed using the Crystal Active Data Driver this method can be used to provide an active data source for the report, such as a DAO, ADO, or RDO Recordset or a CDO Rowset. In this case, the object passed to the second parameter of this method replaces, at runtime, the field definition file used to create the report. This method can be invoked only in formatting Idle mode.  When using a secure connection such as SQL Server, some additional code is required (see Remarks below).

Syntax

Sub SetDataSource (data, [dataTag])

Parameters

Parameter
Description
data
Variant data passed to the database driver. For example, with Active data, this must be a Recordset object if you are using DAO, ADO, or the Visual Basic data control. This must be a Rowset object if you are using CDO.
[dataTag]
A value indicating the type of data being passed to the DatabaseTable object in the Data parameter. Currently, the only possible value is 3. This value must be used for all Active data sources including DAO, ADO, RDO, CDO, and the Visual Basic data control.
Remarks

 	When the data source uses a secure connection, such as SQL Server, additional information must be passed in the "form load" event before the call to view the report. For example,

DataEnvironment1.Command1

Report.DatabaseTable.SetDataSource (DataEnvironment1.rsCommand1)

 	SetDataSource method is used to set a datasource at runtime. If the report is initially created and then saved, and then later run using either the RDC or CRW, the runtime datasource (DAO, ADO, or RDO Recordset) cannot be recreated. The user will not be able to run or preview the report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetLogOnInfo Method (DatabaseTable Object)

The SetLogOnInfo method logs on to the data source so table data can be accessed.

Syntax

Sub SetLogOnInfo (pServerName As String,

[pDatabaseName], [pUserID], [pPassword])

Parameters

Parameter
Description
pServerName
Specifies the name of the server or ODBC data source where the database is located (that is, CRSS).
[pDatabaseName]
Specifies the name of the database.
[pUserID]
Specifies a valid user name for logging on to the data source.
[pPassword]
Specifies a valid password for logging on to the data source.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetSessionInfo Method (DatabaseTable Object)

The SetSessionInfo method allows the user to log on to a secured Access session.

Syntax

Sub SetSessionInfo (pSessionUserID As String, pSessionPassword As String)

Parameters

Parameter
Description
pSessionUserID
Specifies the Access userID used to log on to an Access session.
pSessionPassword
Specifies the session password for Access secured session.
Remarks

In Microsoft Access 95 and later, an Access database can have session security (also known as user-level security), database-level security, or both. If the Access database contains only session security, simply pass the session password to the SessionPassword parameter. If the Access database contains database-level security, use a linefeed character, Chr(10), followed by the database-level password. For example:

object.SetSessionInfo "userID", Chr(10) & "dbpassword"

If the Access database contains both session security and database-level security, use the session password followed by the linefeed character and the database password.

object.SetSessionInfo "userID", _

       "sesspswd" & Chr(10) & "dbpassword"

Alternately, database-level security can also be handled by assigning the database-level password to the Password parameter of the SetLogOnInfo Method (DatabaseTable Object).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetTableLocation Method (DatabaseTable Object)

The SetTableLocation method is used to set the DatabaseTable location, sublocation, and connect buffer string.

Syntax

Sub SetTableLocation (pLocation As String, pSubLocation As String,

    pConnectBufferSting As String)

Parameters

Parameter
Description
pLocation
Specifies the location of the database table (file path and name.ext).
pSubLocation
Specifies the sublocation of the database table.
pConnectBufferSting
Specifies the connection buffer string.
Remarks

For example:

object.SetTableLocation "xtreme.mdb", "Customer", ""

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


TestConnectivity Method (DatabaseTable Object)

The TestConnectivity method tests to see if the database can be logged on to with the current information and if the database table can be accessed by the report.

Syntax

Function TestConnectivity () As Boolean

Returns

 	TRUE if the database session, log on, and location information is all correct.

 	FALSE if the connection fails or an error occurs.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DatabaseTables Collection

The DatabaseTables Collection is a collection of DatabaseTable objects. A DatabaseTable object exists for every database object (for example, table, query, stored procedure, etc.) accessed by the report. Access a specific DatabaseTable Object in the collection using the Item property.

DatabaseTables Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of database objects in the collection.
Read only
None
Item (index
As Long)
DatabaseTable Object
. Item has an index parameter that is a numeric, 1-based index (for example, Item (1)). The items in the collection are indexed in the order in which they were added to the report.
Read only
None
Parent
Database Object
. Reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a table directly (for example, DatabaseTable(1)).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DatabaseTables Collection Methods

The following methods are discussed in this section:

Add Method (DatabaseTables Collection)

Delete Method (DatabaseTables Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (DatabaseTables Collection)

The Add method is used to add a database table to the report.

Syntax

Sub Add (pLocation As String, [pSubLocation], [pConnectInfo],

    [tableType], [pDllName], [pServerName], [pServerType],

    [pDatabaseName], [pUserID], [pPassword])

Parameters

Parameter
Description
pLocation
Specifies the location of the database table that you want to add to the report.
[pSubLocation]
Specifies the sublocation of the database table that you want to add to the report.
[pConnectInfo]
Specifies the connection string.
[tableType]
Specifies the type of database table that you want to add to the report.
[pDllName]
Specifies the DLL name for the database containing the table that you want to add.
[pServerName]
Specifies the database Server Name.
[pServerType]
Specifies the database Server Type.
[pDatabaseName]
Specifies the database (file path and name.ext) containing the table that you want to add.
[pUserID]
Specifies the User’s ID.
[pPassword]
Specifies the User’s Password.
Remarks

 	DatabaseTables.Add method is very generic and can be used to add tables to a report from all kinds of data sources (for example, PC Table, SQL Server, ODBC, OLE DB provider, ADO, RDO, DAO Recordset).

 	For example:

object.Add "xtreme.mdb", "Customer"

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (DatabaseTables Collection)

Use Delete method to remove a database table from the Collection.

Syntax

Sub Delete (index As Long)

Parameter

Parameter
Description
index
Specifies the 1-based index number in the Collection of the database table that you want to delete.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ExportOptions Object

The ExportOptions object provides properties and methods for retrieving information and setting options for exporting your report (that is, export format, destination, etc.). An ExportOptions Object is obtained from the ExportOptions property of the Report Object.

ExportOptions Object Properties

Property
Description
Read/Write
Restriction in event handler
ApplicationFile
Name
String. Gets or sets the destination application file name.
Read/Write
Set before exporting report to an application destination.
CharFieldDelimiter
String. Gets or sets the character used to separate fields in character separated text formats. This character delimits every field in the file.
Read/Write
None
CharStringDelimiter
String. Gets or sets the character used to separate strings in character separated text formats. This character delimits only string fields (numeric, date fields, etc., have no delimiter).
Read/Write
None
DestinationDLL
Name
String. Gets the Internal Name property of the DLL used to export the report to a certain destination. The destination is set in the DestinationType property.
Read only
None
DestinationType
CRExportDestinationType
. Gets or sets the export destination type.
Read/Write
None
DiskFileName
String. Gets or sets the file name if the report is exported to a disk.
When exporting to HTML use HTMLFileName. When exporting to XML use XMLFileName.
Read/Write
None
ExcelAreaGroup
Number
Integer. Gets or sets the base area group number if the area type is group area when exporting to Excel.
Read/Write
None
ExcelAreaType
CRAreaKind
. Gets or sets the base area type if not using constant column width when exporting to Excel.
Read/Write
None
ExcelConstant
ColumnWidth
Double. Gets or sets the column width when exporting to Excel.
Read/Write
None
ExcelTabHas
ColumnHeadings
Boolean. Gets or sets exporting to Excel has column headings option.
Read/Write
None
ExcelUseConstant
ColumnWidth
Boolean. Gets or sets export to Excel to use constant column width.
Read/Write
None
ExcelUseTabular
Format
Boolean. Gets or sets exporting to Excel to use tabular format.
Read/Write
None
ExcelUseWorksheet
Functions
Boolean. Gets or sets export to Excel to use worksheet functions to represent subtotal fields in the report.
Read/Write
None
Exchange
DestinationType
CRExchangeDestinationType
. Gets or sets  the Exchange destination type for reports exported to Exchange folders.
Read/Write
None
ExchangeFolderPath
String. Gets or sets the path of the Exchange folder for reports exported to Exchange (for example, "MyFolders@Inbox").
Read/Write
None
ExchangePassword
String. Sets Exchange password.
Write only
None
ExchangeProfile
String. Gets or sets a user profile for accessing an Exchange folder for reports exported to Exchange.
Read/Write
None
ExchangePathHas
ColumnHeadings
Boolean. Gets or sets the column heading option when exporting to Exchange.
Read/Write
None
FormatDLLName
String. Gets the Internal Name property of the DLL used to export the report to a certain format type. The export format type is set in the FormatType property.
Read only
None
FormatType
CRExportFormatType
. Gets or sets the format type for the exported report (for example, text, Excel, etc.).
Read/Write
None
HTMLEnable
SeperatedPages
Boolean. Gets or sets the option to create seperated pages when exporting to HTML format.
Read/Write
None
HTMLFileName
String. Gets or sets the HTML file name for reports exported to HTML format.
Read/Write
None
HTMLHasPage
Navigator
Boolean. Gets or sets the option to display a page navigator on each page of a report exported to HTML format.
Read/Write
None
LotusDomino
Comments
String. Gets or sets the destination Lotus Domino comments.
Read/Write
None
LotusDomino
DatabaseName
String. Gets or sets the destination Lotus Domino database name.
Read/Write
None
LotusNotesForm
Name
String. Gets or sets the destination Lotus Domino form name.
Read/Write
None
MailBccList
String. Gets or sets a Blind Carbon Copy (BCC) list for reports e-mailed to a VIM e-mail account.
Read/Write
None
MailCcList
String. Gets or sets a Carbon Copy (CC) list for reports e-mailed.
Read/Write
None
MailMessage
String. Gets or sets the e-mail message included with e-mailed reports.
Read/Write
None
MailSubject
String. Gets or sets the e-mail subject heading for reports being e-mailed.
Read/Write
None
MailToList
String. Gets or sets the To list for reports being e-mailed.
Read/Write
None
NumberOfLines
PerPage
Integer. Gets or sets the number of lines to appear per page option for reports exported to a paginated text format.
Read/Write
None
ODBC
DataSourceName
String. Gets or sets the ODBC data source for reports exported to ODBC.
Read/Write
None
ODBCDataSource
Password
String. Sets the ODBC data source password.
Write only
None
ODBCDataSource
UserID
String. Gets or sets the user name used to access an ODBC data source for reports exported to ODBC.
Read/Write
None
ODBCExportTable
Name
String. Gets or sets the database table in the ODBC data source that the report file exported to ODBC will be appended to. You can also create a new table using this property.
Read/Write
None
PDFExportAllPages
Boolean. Gets or sets wether or not to export all pages of the report to Portable Document Format(PDF). PDFExportAllPages must be set to false when setting PDFFirstPageNumber and PDFLastPageNumber.
Read/Write
None
PDFFirstPage
Number
Long. Gets or sets the start page, of a page export range, when exporting to PDF. PDFExportAllPages must be set to False or this value is ignored.
Read/Write
None
PDFLastPage
Number
Long. Gets or sets the end page, of a page export range, when exporting to PDF. PDFExportAllPages must be set to False or this value is ignored.
Read/Write
None
Parent
Report Object
. Reference to the parent object.
Read only
None
RTFExportAllPages
Boolean. Gets or sets wether or not to export all pages of the report to Rich Text Format(RTF). RTFExportAllPages must be set to false when setting RTFFirstPageNumber and RTFLastPageNumber.
Read/Write
None
RTFFirstPage
Number
Long. Gets or sets the start page, of a page export range, when exporting to RTF. RTFExportAllPages must be set to False or this value is ignored.
Read/Write
None
RTFFLastPage
Number
Long. Gets or sets the end page, of a page export range, when exporting to RTF. RTFExportAllPages must be set to False or this value is ignored.
Read/Write
None
UseReportDate
Format
Boolean. Gets or sets whether the date format used in the report should also be used in the exported report. Can be used for Data Interchange Format (DIF), Record Style Format, and comma, tab, or character separated format.
Read/Write
None
UseReportNumber
Format
Boolean. Gets or sets whether the number format used in the report should also be used in the exported report. Can be used for Data Interchange Format (DIF), Record Style Format, and comma, tab, or character separated format.
Read/Write
None
XMLAllowMultiple
Files
Boolean. Gets or sets allow multiple files, when exporting to XML. When set to True the Schema file for the report will be exported along with the XML file. The Schema file will be either an XML schema (.xsd) or a Document Type Definition (.dtd), depending on the options selected in the XML Forma dilaog box. For more information see "Customizing XML report definitions"
in the
Crystal Reports Users Guide
.
Read/Write
None
XMLFileName
String. Gets or sets the file name if the report is exported to a disk.
Read/Write
None
Remarks

For backwards compatibility the FormatDllName and DestinationDllName properties return the Internal Name property of the associated DLL. The Internal Name property of the DLL is found in the DLLs Properties Dialog box under the Version tab. For a list of export DLLs see "Export Destination" and "Export Format" in the Runtime help (Runtime.hlp).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ExportOptions Object Methods

The following methods are discussed in this section:

PromptForExportOptions Method (ExportOptions Object)

Reset Method (ExportOptions Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PromptForExportOptions Method (ExportOptions Object)

The PromptForExportOptions method prompts the user for export information using default Crystal Report Engine dialog boxes.

Syntax

Sub PromptForExportOptions ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Reset Method (ExportOptions Object)

The Reset method clears all ExportOptions properties.

Syntax

Sub Reset ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldDefinitions Collection

The FieldDefinitions Collection contains the various types of XXXFieldDefinition Objects (for example, DatabaseFieldDefinition, FormulaFieldDefinition, SummaryFieldDefinition).  For the current release, developers can access the FieldDefinitions Collection only through the ConditionFields Property of GraphObject.

FieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in event handler
Count
Long. Gets the collection count.
Read only
None
Item (index As Long)
IFieldDefinition Object
. Gets the collection item.
Read only
None
Parent
IReportObject. Reference to the parent object (ReportObject).
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldDefinitions Collection Methods

The following methods are discussed in this section:

Add Method (FieldDefinitions Collection)

Delete Method (FieldDefinitions Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (FieldDefinitions Collection)

Use Add method to add the specified Field to the FieldDefinitions Collection.

Syntax

Sub Add (Field)

Parameter

Parameter
Description
Field
Specifies the Field that you want to add to the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (FieldDefinitions Collection)

Use Delete method to remove the specified Field from the FieldDefinitions Collection

Syntax

Sub Delete(Field)

Parameter

Parameter
Description
Field
Specifies the Field that you want to delete from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldMappingData Object

The FieldMappingData Object provides information related to FieldMapping Events. This Object can be accessed through the Report Object FieldMapping Event.

FieldMappingData Object Properties

Property
Description
Read/Write
Restriction in event handler
FieldName
String. Gets or sets the field name.
Read/Write
None
MappingToField
Index
Integer. Gets or sets the index of the mapping to field index in the field list of the new database.
Read/Write
None
TableName
String. Gets or sets field’s table name.
Read/Write
None
ValueType
CRFieldValueType
. Gets or sets the value type that is in the field.
Read/Write
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldObject Object

The FieldObject Object represents a field found in a report (for example, special field, database field, parameter field, etc.). This object provides properties for retrieving information for a field in your report. A FieldObject Object is obtained from the Item property of the ReportObjects Collection, (for example, ReportObjects.Item(Index), where the index can be the 1-based index number of the item or an Object name).

FieldObject Object Properties

Property
Description
Read/Write
Restriction in event handler
AmPmType
CRAMPMType
. Gets or sets the AM/PM type option.
Read/Write
Can be written only when formatting idle or active.
AmString
String. Gets or sets the AM string.
Read/Write
Can be written only when formatting idle or active.
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BooleanOutput
Type
CRBooleanOutputType
. Gets or sets the Boolean output type.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomLineStyle
CRLineStyle
. Gets or sets bottom line style.
Read/Write
Can be written only when formatting idle or active.
CanGrow
Boolean. Gets or sets can the grow option.
Read/Write
Can be written only when formatting idle or active.
CharacterSpacing
Long. Gets or sets the character spacing.
Read/Write
Can be written only when formatting idle.
CloseAtPageBreak
Boolean. Gets or sets the close border on page break option.
Read/Write
Can be written only when formatting idle or active.
CurrencyPosition
Type
CRCurrencyPositionType
. Gets or sets the currency position type.
Read/Write
Can be written only when formatting idle or active.
CurrencySymbol
String. Gets or sets the currency symbol.
Read/Write
Can be written only when formatting idle or active.
CurrencySymbol
Type
CRCurrencySymbolType
. Gets or sets the currency symbol type.
Read/Write
Can be written only when formatting idle or active.
DateCalendarType
CRDateCalendarType
. Gets or sets the date calendar type.
Read/Write
Can be written only when formatting idle.
DateEraType
CRDateEraType
. Gets or sets the date era type.
Read/Write
Can be written only when formatting idle.
DateFirstSeparator
String. Gets or sets the date first separator.
Read/Write
Can be written only when formatting idle or active.
DateOrder
CRDateOrder
. Gets or sets the date order.
Read/Write
Can be written only when formatting idle or active.
DatePrefixSeparator
String. Gets or sets the date prefix separator.
Read/Write
Can be written only when formatting idle or active.
DateSecond
Separator
String. Gets or sets the date second separator.
Read/Write
Can be written only when formatting idle or active.
DateSuffixSeparator
String. Gets or sets the date suffix separator
Read/Write
Can be written only when formatting idle or active.
DateWindows
DefaultType
CRDateWindowsDefaultType
. Gets or sets the date windows default type.
Read/Write
Can be written only when formatting idle.
DayType
CRDayType
. Gets or sets the day type.
Read/Write
Can be written only when formatting idle or active.
DecimalPlaces
Integer. Gets or sets the number decimal places.
Read/Write
Can be written only when formatting idle or active.
DecimalSymbol
String. Gets or sets the decimal symbol.
Read/Write
Can be written only when formatting idle or active.
DisplayReverseSign
Boolean. Gets or sets the reverse sign option.
Read/Write
Can be written only when formatting idle or active.
EnableTight
Horizontal
Boolean. Gets or sets the tight horizontal option.
Read/Write
Can be written only when formatting idle or active.
Field
Object. Gets the field definition object (for example, DatabaseFieldDefinition Object, ParameterFieldDefinition Object, etc.).
Read only
None
FirstLineIndent
Long. Gets or sets the first line indent.
Read/Write
Can be written only when formatting idle.
Font
IFontDisp. Gets or sets the standard OLE font.
Read/Write
Can be written only when formatting idle or active.
HasDropShadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets object height, in twips.
Read/Write
Can be written only when formatting idle or active.
HorAlignment
CRAlignment
. Gets or sets the horizontal alignment.
Read/Write
Can be written only when formatting idle or active.
HourMinute
Separator
String. Gets or sets the hour minute separator.
Read/Write
Can be written only when formatting idle or active.
HourType
CRHourType
. Gets or sets the hour type.
Read/Write
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets which kind of object (for example, box, cross-tab, field, etc.).
Read only
None
LeadingDayPosition
CRLeadingDayPosition
. Gets or sets the leading day position option.
Read/Write
Can be written only when formatting idle.
LeadingDay
Separator
String. Gets or sets the leading day separator.
Read/Write
Can be written only when formatting idle or active.
LeadingDayType
CRLeadingDayType
. Gets or sets the leading day type.
Read/Write
Can be written only when formatting idle or active.
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftIndent
Long. Gets or sets the left indent, in twips.
Read/Write
Can be written only when formatting idle.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
LineSpacing
Double. Gets the line spacing.
Read Only
None
LineSpacingType
CRLineSpacingType
. Gets the line spacing type.
Read Only
None
MaxNumberOf
Lines
Integer. Gets or sets the maximum number of line for a string memo field.
Read/Write
Can be written only when formatting idle or active.
MinuteSecond
Separator
String. Gets or sets minute second separator.
Read/Write
Can be written only when formatting idle or active.
MinuteType
CRMinuteType
. Gets or sets the minute type.
Read/Write
Can be written only when formatting idle or active.
MonthType
CRMonthType
. Gets or sets month type.
Read/Write
Can be written only when formatting idle or active.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle or active.
NegativeType
CRNegativeType
. Gets or sets number negative type.
Read/Write
Can be written only when formatting idle or active.
NextValue
Variant. Gets the field next value.
Read only
Can be written only when formatting idle or active.
Parent
Section Object
. Reference to the parent object.
Read only
Can be written only when formatting idle or active.
PmString
String. Gets or sets the PM string.
Read/Write
Can be written only when formatting idle or active.
PreviousValue
Variant. Gets the field previous value.
Read only
Can be written only when formatting idle or active.
RightIndent
Long. Gets or sets the right indent, in twips.
Read/Write
Can be written only when formatting idle.
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
RoundingType
CRRoundingType
. Gets or sets the number rounding type.
Read/Write
Can be written only when formatting idle or active.
SecondType
CRSecondType
. Gets or sets the seconds type.
Read/Write
Can be written only when formatting idle or active.
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle or active.
SuppressIf
Duplicated
Boolean. Gets or sets the suppress if duplicate option.
Read/Write
Can be written only when formatting idle or active.
SuppressIfZero
Boolean. Gets or sets the suppress if zero option.
Read/Write
Can be written only when formatting idle or active.
TextColor
OLE_COLOR. Gets or sets the object text color.
Read/Write
Can be written only when formatting idle or active.
TextFormat
CRTextFormat
. Gets or sets the text format option for string memo fields.
Read/Write
Can be written only when formatting idle.
TextRotationAngle
CRRotationAngle
. Gets or sets the text rotation angle.
Read/Write
Can be written only when formatting idle.
Thousands
Separators
Boolean. Gets or sets the enable  thousands separators option.
Read/Write
Can be written only when formatting idle or active.
ThousandSymbol
String. Gets or sets the thousand separator symbol.
Read/Write
Can be written only when formatting idle or active.
TimeBase
CRTimeBase
. Gets or sets the time base.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
UseLeadingZero
Boolean. Gets or sets the number uses leading zero option.
Read/Write
Can be written only when formatting idle or active.
UseOneSymbol
PerPage
Boolean. Gets or sets the use one symbol per page option.
Read/Write
Can be written only when formatting idle or active.
UseSystem
Defaults
Boolean. Gets or sets the use system defaults formatting option.
Read/Write
Can be written only when formatting idle or active.
Value
Variant. Gets the field current value.
Read Only
Can be written only when formatting idle or active.
Width
Long. Gets or sets the object width, in twips.
Read/Write
Can be written only when formatting idle or active.
YearType
CRYearType
. Gets or sets the year type.
Read/Write
Can be written only when formatting idle or active.
ZeroValueString
String. Gets or sets the zero value string for number field format.
Read/Write
Can be written only when formatting idle or active.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldObject Object Methods

The following methods are discussed in this section:

SetLineSpacing Method (FieldObject Object)

SetUnboundFieldSource Method (FieldObject Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetLineSpacing Method (FieldObject Object)

Use SetLineSpacing method to get and set the line spacing and line spacing type.

Syntax

Sub SetLineSpacing (LineSpacing As Double,

    LineSpacingType As CRLineSpacingType)

Parameters

Parameter
Description
LineSpacing
Specifies the line spacing.
LineSpacingType
Specifies the line spacing type. Use one of
CRLineSpacingType
.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetUnboundFieldSource Method (FieldObject Object)

Use SetUnbound FieldSource Method to bind a DataSource to an unbound field.

Syntax

Sub SetUnboundFieldSource (pUnboundFieldSource As String)

Parameter

Parameter
Description
pUnboundField
Source
BSTR specifies the datasouce, Crystal formula format. See Remarks below.
Remarks

For example:

object.SetUnboundFieldSource("{Customer.CustomerID}")

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FormattingInfo Object

The FormattingInfo object contains information about the section currently being formatted.

FormattingInfo Object Properties

Property
Description
Read/Write
Restriction in event handler
IsEndOfGroup
Boolean. Gets whether the current formatting section is the end of a group.
Read only
None
IsRepeatedGroup
Header
Boolean. Gets whether the current formatting section is a repeated group header.
Read only
None
IsStartOfGroup
Boolean. Gets whether the current formatting section is the start of a group.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FormulaFieldDefinition Object

The FormulaFieldDefinition Object provides properties and methods for retrieving information and setting options for any named formula field in a report.

FormulaFieldDefinition Object Properties

Property
Description
Read/Write
Restriction in
event handler
FormulaField
Name
String. Gets the formula field name as it appears in the RDC Dataview Panel.
Read only
None
Kind
CRFieldKind
. Gets what kind of field (for example, database, summary, formula, etc.).
Read only
None
Name
String. Gets the unique name of the formula field in Crystal formula format as it would be referenced in the report (for example, {@ExampleFormula}).
Read only
None
NextValue
Variant. Gets the field next value.
Read only
Can be read only when top-level Report object is formatting active.
NumberOfBytes
Integer. Gets the number of bytes required to store the field data in memory.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PreviousValue
Variant. Gets the field previous value.
Read only
Can be read only when top-level Report object is formatting active.
Text
String. Gets or sets the text of the formula. The formula text is changed immediately in the report. If you generate a report with an invalid formula, you may receive an exception error. Syntax can be Crystal Refort or Visual Basic. See Remarks below.
Read/Write
Can be written only when formatting idle.
Value
Variant. Gets the field current value.
Read only
Can be read only when top-level Report object is formatting active.
ValueType
CRFieldValueType
. Gets which type of value is found in the field.
Read only
None
Remarks

Crystal Reports 8.0 supports formulas in Crystal Reports syntax and Visual Basic syntax. When setting text to a formula, the syntax is determined by the FormulaSyntax property of the parent Report Object. The default syntax is Crystal Report syntax (crCrystalSyntaxFormula).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FormulaFieldDefinition Object Methods

The following methods are discussed in this section:

Check Method (FormulaFieldDefinition Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Check Method (FormulaFieldDefinition Object)

The Check method checks formula for errors (syntax errors).

Syntax

Sub Check (pBool As Boolean, ppErrorString As String)

Parameters

Parameter
Description
pBool
Boolean value indicating the condition of the formula string. Will be set to TRUE if the formula is valid and FALSE if the formula contains one or more errors.
ppErrorString
Specifies the error message string if the formula contains an error.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FormulaFieldDefinitions Collection

The FormulaFieldDefinitions Collection is a collection of named formulas in the report. Access a specific FormulaFieldDefinition Object, in the collection using the Item property.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FormulaFieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of formula field definitions in the collection.
Read only
None
Item (index As Long)
FormulaFieldDefinitions Collection
. Gets collection item. See Remarks below.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a formula field directly (for example, FormulaFieldDefinitions(1)).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FormulaFieldDefinitions Collection Methods

The following methods are discussed in this section:

Add Method (FormulaFieldDefinitions Collection)

Delete Method (FormulaFieldDefinitions Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (FormulaFieldDefinitions Collection)

Use Add method to add the specified formula field to the FormulaFieldDefinitions Collection.

Syntax

Function Add (formulaName As String,

    Text As String) As FormulaFieldDefinition

Parameters

Parameter
Description
formulaName
Specifies the formula field that you want to add to the Collection.
Text
Specifies the text of the formula field that you want to add.
Returns

Returns a FormulaFieldDefinition member of the Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (FormulaFieldDefinitions Collection)

Use Delete method to remove the specified formula field from the FormulaFieldDefinitions Collection

Syntax

Sub Delete (index)

Parameter

Parameter
Description
index
Specifies the formula field that you want to delete from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GraphObject Object

The GraphObject Object represents a graph/chart found in a report. This object provides properties for retrieving information and setting options for a graph in your report (that is, graph data type - group, detail or graph display type - bar, pie, etc.).

GraphObject Object Properties

Property
Description
Read/Write
Restriction in
event handler
AutoRangeData2Axis
Boolean. Gets or sets the auto range option for data2 axis. See Remarks below.
Read/Write
Can be written only when formatting idle.
AutoRangeDataAxis
Boolean. Gets or sets the auto range option for data axis. See Remarks below.
Read/Write
Can be written only when formatting idle.
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BarSize
CRBarSize
. Gets or sets the bar size.
Read/Write
Can be written only when formatting idle.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomLineStyle
CRLineStyle
. Gets or sets the bottom line style.
Read/Write
Can be written only when formatting idle or active.
CloseAtPageBreak
Boolean. Gets or sets the close border on page break option.
Read/Write
Can be written only when formatting idle or active.
ConditionFields
FieldDefinitions Collection
. Gets the condition fields Collection.
Read only
None
CrossTabObject
CrossTabObject Object
. Gets the crosstab object if this is a CrossTab chart.
Read only
None
Data2Axis
DivisionMethod
CRDivisionMethod
. Gets or sets the data2 axis division method.
Read/Write
Can be written only when formatting idle.
Data2Axis
DivisionNumber
Long. Gets or sets the data2 axis division number.
Read/Write
Can be written only when formatting idle.
Data2AxisGridline
CRGridlineType
. Gets or sets the data2 axis grid line type.
Read/Write
Can be written only when formatting idle.
Data2Axis
NumberFormat
CRNumberFormat
. Gets or sets the data2 axis number format.
Read/Write
Can be written only when formatting idle.
DataAxis
DivisionMethod
CRDivisionMethod
. Gets or sets the data axis division method.
Read/Write
Can be written only when formatting idle.
DataAxis
DivisionNumber
Long. Gets or sets the data axis division number.
Read/Write
Can be written only when formatting idle.
DataAxisGridline
CRGridlineType
. Gets or sets the data axis grid line type.
Read/Write
Can be written only when formatting idle.
DataAxis
NumberFormat
CRNumberFormat
. Gets or sets the data axis number format.
Read/Write
Can be written only when formatting idle.
DataLabelFont
IFontDisp. Gets or sets standard OLE font for chart data labels.
Read/Write
Can be written only when formatting idle.
DataPoint
CRGraphDataPoint
. Gets or sets the graph data points on risers.
Read/Write
Can be written only when formatting idle.
DataTitleFont
IFontDisp. Gets or sets standard OLE font for chart data title.
Read/Write
Can be written only when formatting idle.
DataType
CRGraphDataType
. Returns which type of data used in the graph.
Read only
None
DataValueNumber
Format
CRNumberFormat
. Gets or sets the data value number format.
Read/Write
Can be written only when formatting idle.
EnableAutoScale
DataAxis
Boolean. Gets or sets the data axis auto-scale option.
Read/Write
Can be written only when formatting idle.
EnableAutoScale
Data2Axis
Boolean. Gets or sets the data2 axis auto-scale option.
Read/Write
Can be written only when formatting idle.
EnableForEachRecord
Boolean. Gets or sets the enable for each record option.
Read/Write
Can be written only when formatting idle.
EnableShowLegend
Boolean. Gets or sets the show legend option.
Read/Write
Can be written only when formatting idle.
EnableSummarize
Values
Boolean. Gets or sets the enable summarize values option.
Read/Write
Can be written only when formatting idle.
FootNote
String. Gets or sets the footnote.
Read/Write
Can be written only when formatting idle.
FootnoteFont
IFontDisp. Gets or sets standard OLE font for chart footnote.
Read/Write
Can be written only when formatting idle.
GraphColor
crgraphcolor. Gets or sets the graph color.
Read/Write
Can be written only when formatting idle.
GraphDirection
CRGraphDirection
. Gets or sets the graph direction.
Read/Write
Can be written only when formatting idle.
GraphType
CRGraphType
. Gets or sets the graph type.
Read/Write
Can be written only when formatting idle.
GroupAxisGridline
CRGridlineType
. Gets or sets the group axis grid line type.
Read/Write
Can be written only when formatting idle.
GroupLabelFont
IFontDisp. Gets or sets standard OLE font for chart group labels.
Read/Write
Can be written only when formatting idle.
GroupsTitle
String. Gets or sets the groups title.
Read/Write
Can be written only when formatting idle.
GroupTitleFont
IFontDisp. Gets or sets standard OLE font for chart group title.
Read/Write
Can be written only when formatting idle.
HasDropShadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets the object height, in twips.
Read/Write
Can be written only when formatting idle or active.
IsFootnoteByDefault
Boolean. Gets or sets footnote default flag.
Read/Write
Can be written only when formatting idle or active.
IsGroupsTitleBy
Default
Boolean. Gets or set groups title default flag.
Read/Write
Can be written only when formatting idle or active.
IsSeriesTitleByDefault
Boolean. Gets or sets series title default flag.
Read/Write
Can be written only when formatting idle or active.
IsSubTitleByDefault
Boolean. Get or sets subtitle default flag.
Read/Write
Can be written only when formatting idle or active.
IsTitleByDefault
Boolean. Gets or sets title default flag.
Read/Write
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets which kind of object (for example, box, cross-tab, etc.).
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
LegendFont
IFontDisp. Gets or sets standard OLE font for legend.
Read/Write
Can be written only when formatting idle.
LegendLayout
CRPieLegendLayout
. Gets or sets the legend layout for a pie chart.
Read/Write
Can be written only when formatting idle.
LegendPosition
CRLegendPosition
. Gets or sets the legend position.
Read/Write
Can be written only when formatting idle.
MarkerShape
CRMarkerShape
. Gets or sets the marker shape.
Read/Write
Can be written only when formatting idle.
MarkerSize
CRMarkerSize
. Gets or sets the marker size.
Read/Write
Can be written only when formatting idle.
MaxData2AxisValue
Double. Gets or sets data2-axis max value. See Remarks below.
Read/Write
Can be written only when formatting idle.
MaxDataAxisValue
Double. Gets or sets data-axis max value. See Remarks below.
Read/Write
Can be written only when formatting idle.
MinData2AxisValue
Double. Gets or sets data2-axis min value. See Remarks below.
Read/Write
Can be written only when formatting idle.
MinDataAxisValue
Double. Gets or sets data-axis min value. See Remarks below.
Read/Write
Can be written only when formatting idle.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
PieSize
CRPieSize
. Gets or sets the size for pie charts.
Read/Write
Can be written only when formatting idle.
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
SeriesAxisGridline
CRGridlineType
. Gets or sets the series axis grid line type.
Read/Write
Can be written only when formatting idle.
SeriesLabelFont
IFontDisp. Gets or sets standard OLE font for chart series labels.
Read/Write
Can be written only when formatting idle.
SeriesTitle
String. Gets or sets the series title.
Read/Write
Can be written only when formatting idle.
SeriesTitleFont
IFontDisp. Gets or sets standard OLE font for chart series title.
Read/Write
Can be written only when formatting idle.
SliceDetachment
CRSliceDetachment
. Gets or sets the slice detachment.
Read/Write
Can be written only when formatting idle.
SubTitle
String. Gets or sets subtitle.
Read/Write
Can be written only when formatting idle.
SubTitleFont
IFontDisp. Gets or sets standard OLE font for chart subtitle.
Read/Write
Can be written only when formatting idle.
SummaryFields
SummaryFieldDefinitions Collection
. Gets the summary fields Collection.
Read only
None
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle or active.
Title
String. Gets or sets the title.
Read/Write
Can be written only when formatting idle.
TitleFont
IFontDisp. Gets or sets standard OLE font for chart title.
Read/Write
Can be written only when formatting idle.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
ViewingAngle
CRViewingAngle
. Gets or sets the viewing angle.
Read/Write
Can be written only when formatting idle.
Width
Long. Gets or sets the object width, in twips.
Read/Write
Can be written only when formatting idle or active.
Remarks

Properties Max/MinData/SeriesAxisValue will be ignored if the corresponding AutoRangeData/SeriesAxis property is set to TRUE. If the Max/MinDataDataAxis/Series properties are set at runtime, then the corresponding AutoRangeData/SeriesAxis must be set to FALSE.

This property must be set to FALSE...
...or this property will be ignored
AutoRangeData2Axis
MaxData2AxisValue
AutoRangeDataAxis
MaxDataAxisValue
AutoRangeData2Axis
MinData2AxisValue
AutoRangeDataAxis
MinDataAxisValue
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GroupNameFieldDefinition Object

The GroupNameFieldDefinition Object provides properties and methods for retrieving information on a group name field found in a report (for example, number of group, value type, etc.). A GroupNameFieldDefinition Object can be obtained from the Field property of the FieldObject Object when the specified field is a group name field or from a GroupNameFieldDefinitions Collection retrieved from the GroupNameFields property of the Report Object.

GroupNameFieldDefinition Object Properties

Property
Description
Read/Write
Restriction in
event handler
GroupNameField
Name
String. Gets the group name field name.
Read only
None
GroupNumber
Integer. If the area is a group, this gets the group number. Otherwise, exception is thrown.
Read only
None
Kind
CRFieldKind
. Gets which kind of field (for example, database, summary, formula, etc.).
Read only
None
Name
String. Gets the field definition unique formula name in Crystal Report formula syntax.
Read only
None
NextValue
Variant. Gets the field next value.
Read only
Can be read only when top-level Report object is formatting active.
NumberOfBytes
Integer. Gets the number of bytes required to store the field data in memory.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PreviousValue
Variant. Gets the field previous value.
Read only
Can be read only when top-level Report object is formatting active.
Value
Variant. Gets the field current value.
Read only
Can be read only when top-level Report object is formatting active.
ValueType
CRFieldValueType
. Gets which type of value is found in the field.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GroupNameFieldDefinitions Collection

The GroupNameFieldDefinitions Collection is a collection of named groups in the report. Access a specific GroupNameFieldDefinition Object in the collection using the Item property.

GroupNameFieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of group name field definitions in the Collection.
Read only
None
Item (index
As Long)
GroupNameFieldDefinition Object
. Gets the specified object from the Collection. Item has an index parameter that is the 1-based index number of the Object in the Collection. The items in the collection are indexed in the order they were added to the report.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a group name field directly (for example, GroupNameFieldDefinitions(1)).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


IFieldDefinition Object

The IFieldDefinition Object provides generic properties for the various types of field definition objects.

IFieldDefinition Object Properties

Property
Description
Read/Write
Restriction in event handler
Kind
CRFieldKind
. Gets field definition kind.
Read only
None
Name
String. Gets field definition unique formula name.
Read only
None
NextValue
Variant. Gets the field next value.
Read only
None
NumberOfBytes
Integer. Gets field number of bytes.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PreviousValue
Variant. Gets the field previous value.
Read only
None
UseCount
Long. Gets the field use count.
Read only
None
Value
Variant. Gets the field current value.
Read only
None
ValueType
CRFieldValueType
. Gets the field value type.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


IReportObject

The IReportObject Object provides generic properties for the various types of report objects.

IReportObject Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomLineStyle
CRLineStyle
. Gets or sets bottom line style.
Read/Write
Can be written only when formatting idle or active.
CloseAtPageBreak
Boolean. Gets or sets the close border on page break option.
Read/Write
Can be written only when formatting idle or active.
EnableTight
Horizontal
Boolean. Gets or sets the enable tight horizontal option.
Read/Write
Can be written only when formatting idle or active.
HasDropShadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets object height, in twips.
Read/Write
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets which kind of object (for example, box, cross-tab, field, etc.).
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle or active.
Parent
Section Object
. Reference to the parent object.
Read only
Can be written only when formatting idle or active.
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets or sets the object width, in twips.
Read/Write
Can be written only when formatting idle or active.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


LineObject Object

The LineObject Object represents a line drawn on a report. This object provides properties for getting information for lines on a report.

LineObject Object Properties

Property
Description
Read/Write
Restriction in event handler
Bottom
Long. Gets or sets the line lower bottom position, in twips.
Read/Write
Can be written only when formatting idle.
EndSection
Section Object
. Gets the end section.
Read only
None
ExtendToBottom
OfSection
Boolean. Gets or sets the extend to bottom of section option.
Read/Write
Can be written only when formatting idle.
Kind
CRObjectKind
. Gets which kind of object (for example, box, cross-tab, field, etc.).
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle.
LineColor
OLE_COLOR. Gets or sets the line color.
Read/Write
Can be written only when formatting idle.
LineStyle
CRLineStyle
. Gets or sets the line style. See Remarks below.
Read/Write
Can be written only when formatting idle.
LineThickness
Long. Gets or sets the line thickness, in twips.
Read/Write
Can be written only when formatting idle.
Name
String. Gets or sets object name.
Read/Write
Can be written only when formatting idle.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
Right
Long. Gets or sets the line lower right position, in twips.
Read/Write
Can be written only when formatting idle.
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle.
Remarks

For property LineStyle, crLSDoubleLine and crLSNoLine are not valid.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


MapObject Object

The MapObject Object represents a geographic map object in a report. This object provides properties for getting information for Map objects in a report.

MapObject Object Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomLine
Style
CRLineStyle
. Gets or sets the bottom line style.
Read/Write
Can be written only when formatting idle or active.
CloseAtPage
Break
Boolean. Gets or sets the close border on page break option.
Read/Write
Can be written only when formatting idle or active.
HasDrop
Shadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets the object height, in twips.
Read/Write
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets which kind of object (for example, box, cross-tab, field, etc.).
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets or sets the object width, in twips.
Read/Write
Can be written only when formatting idle or active.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ObjectSummaryFieldDefinitions Collection

ObjectSummaryFieldDefinitions is a Collection of SummaryFieldDefinition Object Objects.

ObjectSummaryFieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of object summary field definitions in the Collection.
Read only
None
Item (index
As Long)
SummaryFieldDefinition Object
. Gets the specified object from the Collection. Item has an index parameter that is the 1-based index number of the Object in the Collection. The items in the collection are indexed in the order they were added to the report.
Read only
None
Parent
IReportObject
. Gets reference to the parent object.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ObjectSummaryFieldDefinitions Collection Methods

The following methods are discussed in this section:

Add Method (ObjectSummaryFieldDefinitions Collection)

Delete Method (ObjectSummaryFieldDefinitions Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (ObjectSummaryFieldDefinitions Collection)

Use Add method to add the specified object summary field to the ObjectSummaryFieldDefinitions Collection.

Syntax

Sub Add (summaryField)

Parameter

Parameter
Description
summaryField
Specifies the formula field that you want to add to the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (ObjectSummaryFieldDefinitions Collection)

Use Delete method to remove the specified object summary field from the ObjectSummaryFieldDefinitions Collection.

Syntax

Sub Delete (index As Long)

Parameter

Parameter
Description
index
Specifies the object summary field that you want to delete from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OlapGridObject Object

The OlapGridObject Object represents an Olap Object in a report.

OlapGridObject Object Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomLineStyle
CRLineStyle
. Gets or sets the bottom line style.
Read/Write
Can be written only when formatting idle or active.
CloseAtPageBreak
Boolean. Gets or sets the close border on page break option.
Read/Write
Can be written only when formatting idle or active.
HasDropShadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets the object height, in twips.
Read only
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets report object kind.
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle or active.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets the object width, in twips.
Read only
Can be written only when formatting idle or active.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OleObject Object

The OleObject Object represents an OLE object in a report. This object provides properties for getting information for OLE objects in a report.

OleObject Object Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
Bottom
Cropping
Long. Gets or sets the bottom cropping size, in twips.
Read/Write
Can be written only when formatting idle.
BottomLine
Style
CRLineStyle
. Gets or sets the bottom line style.
Read/Write
Can be written only when formatting idle or active.
CloseAtPage
Break
Boolean. Gets or sets the close border on page break option.
Read/Write
Can be written only when formatting idle or active.
Formatted
Picture
IPictureDisp. Gets or sets the specified picture during formatting.
Read/Write
Can be read or written only when top-level Report object is formatting active.
HasDrop
Shadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets the object height, in twips.
Read/Write
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets which kind of object (for example, box, cross-tab, field, etc.).
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftCropping
Long. Gets or sets the left cropping size, in twips.
Read/Write
Can be written only when formatting idle.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
RightCropping
Long. Gets or sets the right cropping size, in twips.
Read/Write
Can be written only when formatting idle.
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
Suppress
Boolean. Gets or sets the object visibility.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopCropping
Long. Gets or sets the top cropping size, in twips.
Read/Write
Can be written only when formatting idle.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets or sets the object width, in twips.
Read/Write
Can be written only when formatting idle or active.
XScaling
Double. Gets or sets the width scaling factor. For example, 1 means 100%, 2 means 200%, 0.5 means 50% etc. The scaling factor may range from 0.01 to 100.
Read/Write
Can be written only when formatting idle.
YScaling
Double. Gets or sets height scaling factor. For example, 1 means 100%, 2 means 200%, 0.5 means 50% etc. The scaling factor may range from 0.01 to 100.
Read/Write
Can be written only when formatting idle.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OleObject Object Methods

The following methods are discussed in this section:

SetOleLocation Method (OleObject Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetOleLocation Method (OleObject Object)

Use SetOleLocation method to specify the location of an OLE Object.

Syntax

Sub SetOleLocation (pLocation As String)

Parameter

Parameter
Description
pLocation
Specifies the location of the OLE Object.
Remarks

SetOleLocation must be called from the Format Event of the Section object, and only when formatting active. For more more information see Format Event (Section Object).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Page Object

The Page Object is part of the Page Engine. Use the Page Engine when designing web sites using Active Server Pages, the Crystal Report Engine Automation Server, and the Crystal Design-Time ActiveX Control. Unless you are experienced with the Crystal Report Engine Object Library, you should allow the Crystal Design-Time ActiveX Control to generate VBScript code in your Active Server Pages that controls the Page Engine objects.

The Page Engine generates pages of a report on the web server and sends the pages to client web browsers as they are requested. For example, when a user first requests a report, only the first page is sent to the web browser. If the user pages forward or backward in the report, or requests a specific page, only that page is sent. This limits the resources required by the web server and reduces download time for the client browser. A Page Object is a single generated page that is sent to the browser.

Page Object Properties

Property
Description
Read/Write
Restriction in
event handler
IsLastPage
Boolean. Gets whether the page generated is the last page of the report.
Read only
None
IsMissing
TotalPageCount
Boolean. Gets whether the page misses the total page count.
Read only
None
PageNumber
Long. Gets the page number.
Read only
None
Parent
PageGenerator Object
. Gets reference to the parent object.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Page Object Methods

The following methods are discussed in this section:

RenderEPF Method (Page Object)

RenderHTML Method (Page Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RenderEPF Method (Page Object)

The RenderEPF method returns a variant that contains EPF data for the report page. This method can be invoked only when in formatting idle mode.

Syntax

Function RenderEPF (resultType As CRRenderResultType)

Parameter

Parameter
Description
ResultType
CRRenderResultType
. Specifies whether the page will be rendered using strings or arrays. See Remarks below.
Returns

Returns the EPF stream.

Remarks

Currently only arrays are supported.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RenderHTML Method (Page Object)

The RenderHTML method returns a variant that contains HTML data for the report page. This method can be invoked only when in formatting idle mode.

Syntax

Function RenderHTML (includeDrillDownLinks As Boolean,

    pageStyle As CRHTMLPageStyle, toolbarStyle As CRHTMLToolbarStyle,

    baseURL As String, resultType As CRRenderResultType)

Parameters

Parameter
Description
includeDrillDown
Links
Indicates whether or not the HTML page will include hyperlinks for drilling-down on summary data.
pageStyle
CRHTMLPageStyle
. Specifies the style of the HTML page to be rendered.
toolbarStyle
CRHTMLToolbarStyle
. Bitwise constant specifies the style of the toolbar to be used. Constants can be XOR’d.
baseURL
The URL used to access the report when it is first generated.
resultType
CRRenderResultType
. Specifies whether the page will be rendered using strings or arrays. See Remarks below.
Returns

Returns the HTML stream.

Remarks

Currently only arrays are supported.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PageEngine Object

Use the PageEngine object when designing web sites using Active Server Pages, the Crystal Report Engine Automation Server, and the Crystal Design-Time ActiveX Control. Unless you are experienced with the Crystal Report Engine Object Library, you should allow the Crystal Design-Time ActiveX Control to generate VBScript code in your Active Server Pages that controls the Page Engine objects.

The Page Engine generates pages of a report on the web server and sends the pages to client web browsers as they are requested. For example, when a user first requests a report, only the first page is sent to the web browser. If the user pages forward or backward in the report, or requests a specific page, only that page is sent. This limits the resources required by the web server and reduces download time for the client browser.

PageEngine Object Properties

Property
Description
Read/Write
Restriction in event handler
ImageOptions
CRImageType
. Gets or sets the image type for EPF format.
Read/Write
Can be written only when formatting idle.
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PlaceHolder
Options
CRPlaceHolderType
. Gets or sets the EPF place holder options.
Read/Write
Can be written only when formatting idle.
ValueFormat
Options
CRValueFormatType
. Gets or sets the EPF value format options.
Read/Write
Can be written only when formatting idle.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PageEngine Object Methods

The following methods are discussed in this section:

CreatePageGenerator Method (PageEngine Object)

RenderTotallerETF Method (PageEngine Object)

RenderTotallerHTML Method (PageEngine Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CreatePageGenerator Method (PageEngine Object)

The CreatePageGenerator method returns a PageGenerator Object, allowing you to get pages from the view of the report, specified by the GroupPath parameter. This method can be invoked only when in formatting idle mode.

Syntax

Function CreatePageGenerator (GroupPath, [DrillDownLevel]) As PageGenerator

Parameter

Parameter
Description
GroupPath
Specifies an integer array that represents the group path. An empty array would represent the entire report, an array (0, 1) would represent a drill down on the second group member within the first group member where 0 = first group in Group #1 and 1 = second group in Group #2.
[DrillDownLevel]
Reserved. Do not use.
Returns

Returns a PageGenerator Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RenderTotallerETF Method (PageEngine Object)

The RenderTotallerETF method returns a variant that contains ETF data for the Group Tree. This method can be invoked only when in formatting idle mode.

Syntax

Function RenderTotallerETF (rootGroupPath, startingChildNumber As Long,

    pastRootLevels As Integer, maxNodeCount,

    resultType As CRRenderResultType)

Parameters

Parameter
Description
rootGroupPath
Specifies an integer array that represents the group path. An empty array would represent the entire report, an array (0, 1) would represent a drill down on the second group member within the first group member where 0 = first group in Group #1 and 1 = second group in Group #2.
startingChildNumber
The start child number to display.
pastRootLevels
Past root levels.
maxNodeCount
The maximum number of nodes for each group level in the Group Tree.
resultType
CRRenderResultType
. Specifies whether the page will be rendered using strings or arrays. See Remarks below.
Returns

Returns the Totaller ETF stream.

Remarks

Currently only arrays are supported.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RenderTotallerHTML Method (PageEngine Object)

The RenderTotallerHTML method returns a variant that contains HTML data for the Group Tree. This method can be invoked only when in formatting idle mode.

Syntax

Function RenderTotallerHTML (rootGroupPath, startingChildNumber As Long,

    pastRootLevels As Integer, maxNodeCount, openGroupPath,

    includeDrillDownLinks As Boolean, baseURL As String,

    resultType As CRRenderResultType)

Parameters

Parameter
Description
rootGroupPath
Specifies the base URL string.
startingChildNumber
The start child number to display.
pastRootLevels
A value indicating the number of past root levels.
maxNodeCount
The maximum number of nodes to display for each group level in the Group Tree.
openGroupPath
An array of groups to be opened in the report.
includeDrillDown
Links
Indicates whether or not drill down hyperlinks are generated for summary values in the report.
baseURL
The URL used to access the report when it is first generated.
resultType
CRRenderResultType
. Specifies whether the page will be rendered using strings or arrays. See Remarks below.
Returns

Returns the HTML stream.

Remarks

Currently only arrays are supported.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PageGenerator Object

The PageGenerator Object is part of the Page Engine. Use the Page Engine when designing web sites using Active Server Pages, the Crystal Report Engine Automation Server, and the Crystal Design-Time ActiveX Control. Unless you are experienced with the Crystal Report Engine Object Library, you should allow the Crystal Design-Time ActiveX Control to generate VBScript code in your Active Server Pages that controls the Page Engine objects.

The Page Engine generates pages of a report on the web server and sends the pages to client web browsers as they are requested. For example, when a user first requests a report, only the first page is sent to the web browser. If the user pages forward or backward in the report, or requests a specific page, only that page is sent. This limits the resources required by the web server and reduces download time for the client browser. A PageGenerator object generates Page Object, as they are requested and allows options for manipulating the report as a whole.

PageGenerator Object Properties

Property
Description
Read/Write
Restriction in
event handler
ContainingGroup
Name
String. Gets containing group name for out of place subreport view.
Read only
None
ContainingGroup
Path
Variant. Gets containing group path for out of place subreport view.
Read only
None
ContainingPage
Number
Long. Gets containing page number for out of place subreport view.
Read only
None
DrillDownLevel
Ignore. This property is currently reserved.
Read only
None
GroupName
String. Gets the group name for drill down on graph view.
Read only
None
GroupPath
Variant. Gets the GroupPath parameter set by
CreatePageGenerator Method (PageEngine Object)
.
Read only
None
Pages
Pages Collection
. Gets the collection of pages for a specified view.
Read only
None
Parent
PageEngine Object
. Gets reference to the parent object.
Read only
None
ReportName
String. Gets the report name for drill down on out of place subreport view.
Read only
None
xOffset
Long. Gets the object x-offset.
Read only
None
yOffset
Long. Gets the object y-offset.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PageGenerator Object Methods

The following methods are discussed in this section:

CreateSubreportPageGenerator Method (PageGenerator Object)

DrillOnGraph Method (PageGenerator Object)

DrillOnMap Method (PageGenerator Object)

DrillOnSubreport Method (PageGenerator Object)

Export Method (PageGenerator Object)

FindText Method (PageGenerator Object)

GetPageNumberForGroup Method (PageGenerator Object)

RenderTotallerETF Method (PageGenerator Object)

RenderTotallerHTML Method (PageGenerator Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CreateSubreportPageGenerator Method (PageGenerator Object)

Use CreateSubreportPageGenerator method to create a page generator that contains the subreport view context.

Syntax

Function CreateSubreportPageGenerator (GroupPath, [DrillDownLevel]

    As PageGenerator

Parameters

Parameter
Description
GroupPath
Specifies an integer array that represents the group path. An empty array would represent the entire report, an array (0, 1) would represent a drill down on the second group member within the first group memberwhere 0 = first group in Group #1 and 1 = second group in Group #2.
[DrillDownLevel]
Reserved. Do not use.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DrillOnGraph Method (PageGenerator Object)

The DrillOnGraph method creates a new PageGenerator Object that results from drilling down on the specified point in a graph on the given page. This method can be invoked only when in formatting idle mode.

Syntax

Function DrillOnGraph (PageNumber As Long, xOffset As Long, yOffset As Long

    As PageGenerator

Parameters

Parameter
Description
PageNumber
Specifies the page number.
xOffset
Specifies the X coordinate on page, in twips, where the drill down occurred.
yYOffset
Specifies the Y coordinate on page, in twips, where the drill down occurred.
Returns

Returns a PageGenerator Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DrillOnMap Method (PageGenerator Object)

The DrillOnMap method creates a newPageGenerator Object, that results from drilling down on the specified point in a map on the given page. This method can be invoked only when in formatting idle mode.

Syntax

Function DrillOnMap (PageNumber As Long, xOffset As Long, yOffset As Long

    As PageGenerator

Parameters

Parameter
Description
PageNumber
Specifies the page number.
xOffset
Specifies the X coordinate on page, in twips, where the drill down occurred.
yOffset
Specifies the Y coordinate on page, in twips, where the drill down occurred.
Returns

Returns a PageGenerator Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DrillOnSubreport Method (PageGenerator Object)

The DrillOnSubreport method creates a new PageGenerator Object, that results from drilling down on the specified point in a real-time subreport on the given page. This method can be invoked only when in formatting idle mode.

Syntax

Function DrillOnSubreport (PageNumber As Long, xOffset As Long,

    yOffset As Long) As PageGenerator

Parameters

Parameter
Description
PageNumber
Specifies the page number.
xOffset
Specifies the X coordinate on page, in twips, where the drill down occurred.
yOffset
Specifies the Y coordinate on page, in twips, where the drill down occurred.
Returns

Returns a PageGenerator Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Export Method (PageGenerator Object)

Use Export method to obtain an export stream.

Syntax

Function Export (resultType As CRRenderResultType)

Parameter

Parameter
Description
resultType
CRRenderResultType
. Sepcifies the result type.
Returns

Returns the export data stream.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FindText Method (PageGenerator Object)

Use FindText method to search for a text string in the specified direction starting on the specified page in the current drill down view.

Syntax

Function FindText (Text As String, direction As CRSearchDirection,

    pPageNumber) As Boolean

Parameters

Parameter
Description
Text
Specifies the text string that you want to search for.
direction
CRSearchDirection
. Specifies the direction that you want to search.
pPageNumber
Specifies the page on which you want to start the search.
Returns

 	TRUE if the specified text string is found.

 	FALSE if the specified text string is not found.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetPageNumberForGroup Method (PageGenerator Object)

The GetPageNumberForGroup method returns the page number on which the specified group starts. This method can be invoked only when in formatting idle mode.

Syntax

Function GetPageNumberForGroup (GroupPath) As Long

Parameters

Parameter
Description
GroupPath
Specifies an integer array that represents the group path. An empty array would represent the entire report, an array (0, 1) would represent a drill down on the second group member within the first group memberwhere 0 = first group in Group #1 and 1 = second group in Group #2.
Returns

Returns the page number on which the specified group starts.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RenderTotallerETF Method (PageGenerator Object)

The RenderTotallerETF method returns a variant that contains ETF data for the Group Tree. This method can be invoked only when in formatting idle mode.

Syntax

Function RenderTotallerETF (rootGroupPath, startingChildNumber As Long,

    pastRootLevels As Integer, maxNodeCount,

    resultType As CRRenderResultType)

Parameters

Parameter
Description
rootGroupPath
Specifies an integer array that represents the root group path. An empty array would represent the entire report, an array (0, 1) would represent a drill down on the second group member within the first group member where 0 = first group in Group #1 and 1 = second group in Group #2.
startingChildNumber
The starting child level to display the report grouping at.
pastRootLevels
Specifies the number of past root levels.
maxNodeCount
The maximum number of nodes for each group level in the Group Tree.
resultType
CRRenderResultType
. Specifies whether the page will be rendered using strings or arrays. See Remarks below.
Returns

Returns the Totaller ETF stream.

Remarks

Currently only arrays are supported.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RenderTotallerHTML Method (PageGenerator Object)

The RenderTotallerHTML method returns a variant that contains HTML data for the Group Tree. This method can be invoked only when in formatting idle mode.

Syntax

Function RenderTotallerHTML (rootGroupPath, startingChildNumber As Long,

    pastRootLevels As Integer, maxNodeCount, openGroupPath,

    includeDrillDownLinks As Boolean, baseURL As String,

    resultType As CRRenderResultType)

Parameters

Parameter
Description
rootGroupPath
Specifies an integer array that represents the root group path. An empty array would represent the entire report, an array (0, 1) would represent a drill down on the second group member within the first group member where 0 = first group in Group #1 and 1 = second group in Group #2.
startingChild
Number
The starting child level to display the report grouping at.
pastRootLevels
A value indicating the number of past root levels.
maxNodeCount
The maximum number of nodes to display for each group level in the Group Tree.
openGroupPath
An array of groups to be opened in the report.
includeDrill
DownLinks
Indicates whether or not drill down hyperlinks are generated for summary values in the report.
baseURL
The URL used to access the report when it is first generated.
resultType
CRRenderResultType
. Specifies whether the page will be rendered using strings or arrays. See Remarks below.
Returns

Returns the HTML stream.

Remarks

Currently only arrays are supported.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Pages Collection

The Pages Collection is part of the Page Engine. Use the Page Engine when designing web sites using Active Server Pages, the Crystal Report Engine Automation Server, and the Crystal Design-Time ActiveX Control. Unless you are experienced with the Crystal Report Engine Object Library, you should allow the Crystal Design-Time ActiveX Control to generate VBScript code in your Active Server Pages that controls the Page Engine objects.

The Page Engine generates pages of a report on the web server and sends the pages to client web browsers as they are requested. For example, when a user first requests a report, only the first page is sent to the web browser. If the user pages forward or backward in the report, or requests a specific page, only that page is sent. This limits the resources required by the web server and reduces download time for the client browser.

The Pages Collection is a collection of Page Object. Access a specific Page Object in the collection using the Item property.

Pages Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of page objects in the collection.
Read only
None
Item (index
 As Long)
Page Object
. Gets the collection item based on the 1-based index number.
Read only
None
Parent
PageGenerator Object
. Gets reference to the parent object.
Read only
None
Remarks

Item is a default property. You can reference a page directly, for example, Pages(1).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ParameterFieldDefinition Object

The ParameterFieldDefinition Object represents a parameter field in the report. This object provides properties and methods for retrieving information and setting options for a parameter field in your report (that is, current value, default value, etc.). A ParameterFieldDefinition Object is obtain from the Field property of the FieldObject Object, when the specified field is a parameter field or from the ParameterFieldDefinitions Collection Object under Report.

ParameterFieldDefinition Object Properties

Property
Description
Read/Write
Restriction in
event handler
DisallowEditing
Boolean. Gets or sets the disallowing editing option.
Read/Write
Can be written only when formatting idle.
DiscreteOrRange
Kind
CRDiscreteOrRangeKind
. Gets or sets the parameter value kind (discrete and/or range).
Read/Write
Can be written only when formatting idle.
EditMask
String. Gets or sets edit mask for string parameter. See Remarks below for additional information.
Read/Write
Can be written only when formatting idle.
EnableExclusive
Group
Boolean. Works in conjunction with property PlaceInGroup. If  EnableExclusiveGroup is TRUE, a Bool parameter group can have only one value set to TRUE; if FALSE, then the group can have multiple values set to TRUE.
Read/Write
Can be written only when formatting idle.
EnableMultiple
Values
Boolean. Gets or sets the allow multiple values option.
Read/Write
Can be written only when formatting idle.
EnableNullValue
Boolean. Gets or sets the value nullable option for Stored Procedure parameters.
Read/Write
Can be written only when formatting idle.
EnableRangeLimit
Boolean. Gets or sets the option which specifies if this parameter field value should be in the specified range.
Read/Write
Can be written only when formatting idle.
EnableShow
DescriptionOnly
Boolean. Gets or sets the show description for pick list option.
Read/Write
Can be written only when formatting idle.
EnableSortBasedOn
Desc
Boolean. Gets or sets the sort based on description in pick list option.
Read/Write
Can be written only when formatting idle.
GroupNumber
Integer. Gets or sets boolean group number.
Read/Write
Can be written only when formatting idle.
IsCurrentValueSet
Boolean. Gets whether the current value has been set.
Read only
None
IsDefaultValueSet
Boolean. Gets whether the default value has been set.
Read only
None
Kind
CRFieldKind
. Gets which kind of field (database, summary, formula, etc.).
Read only
None
MaximumValue
Variant. Gets or sets the maximum value. See Remarks below for additional comments.
Read/Write
Can be written only when formatting idle.
MinimumValue
Variant. Gets or sets minimum value. See Remarks below for additional comments.
Read/Write
Can be written only when formatting idle.
Name
String. Gets the unique formula name of the parameter field as it appears in the Parameter Field list (RDC DataView).
Read only
None
NeedsCurrentValue
Boolean. Gets whether the field needs a current value.
Read only
None
NextValue
Variant. Gets the next field value.
Read only
Can be read only when top-level Report object is formatting active.
NthValue
Description (index
 As Integer)
String. Gets or sets nth value description.
Read/Write
Can be written only when formatting idle.
NumberOfBytes
Integer. Gets the number of bytes required to store the field data in memory.
Read only
None
NumberOfCurrent
Ranges
Integer. Gets total number of current ranges.
Read only
None
NumberOfCurrent
Values
Integer. Gets the total number of current values.
Read only
None
NumberOfDefault
Values
Integer. Gets the total number of default values.
Read only
None
ParameterField
Name
String. Gets the name of the parameter field as it is displayed (referenced) in the report (RDC DataView).
Read only
None
ParameterType
CRParameterFieldType
. Gets parameter type.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PickListSortMethod
CRParameterPickListSortMethod
. Gets or sets the sort method in pick list option.
Read/Write
Can be written only when formatting idle.
PlaceInGroup
Boolean. Gets or sets, when prompting for values, whether a Boolean parameter field should appear as part of a Boolean parameter group or individually. Used in conjunction with Boolean property EnableExclusiveGroup.
Read/Write
Can be written only when formatting idle.
PreviousValue
Variant. Gets the field previous value.
Read only
Can be read only when top-level Report object is formattiong active.
Prompt
String. Gets or sets the parameter field prompting string.
Read/Write
None
ReportName
String. Gets the report name the parameter field is in. If it is a main report, the ReportName is empty.
Read only
None
Value
Variant. Gets the current value of the field.
Read only
Can be read only when top-level Report object is formatting active.
ValueType
CRFieldValueType
. Gets which type of value is found in the field.
Read only
None
Remarks

 	Regarding property EditMask, please see the additional information available in Crystal Reports Online Help. Search for "Edit Parameter Field dialog box" in the SCR Online Help index.

 	Regarding properties MaximumValue and MinimumValue, the following comments apply.

 	All parameter field types: EnableRangeLimit property must be set to TRUE for MaximumValue and Minimum Value properties to have an effect.

 	String parameter fields: The properties provide the maximum and minimum lengths of the string, not a value range.

 	Boolean parameter fields: The properties do not apply.

 	Regarding properties EditMask, MaximumValue and MinimumValue, changing values associated with one or more of these properties may result in the loss of default values that do not fall within the scope of the new EditMask, MaximumValue or MinimumValue properties.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ParameterFieldDefinition Object Methods

The following methods are discussed in this section:

AddCurrentRange Method (ParameterFieldDefinition Object)

AddCurrentValue Method (ParameterFieldDefinition Object)

AddDefaultValue Method (ParameterFieldDefinition Object)

ClearCurrentValueAndRange Method (ParameterFieldDefinition Object)

DeleteNthDefaultValue Method (ParameterFieldDefinition Object)

GetNthCurrentRange Method (ParameterFieldDefinition Object)

GetNthCurrentValue Method (ParameterFieldDefinition Object)

GetNthDefaultValue Method (ParameterFieldDefinition Object)

SetNthDefaultValue Method (ParameterFieldDefinition Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddCurrentRange Method (ParameterFieldDefinition Object)

The AddCurrentRange method adds the current parameter range to the specified parameter field of a report. When this method is used, property DiscreteOrRangeKind must be crRangeValue.

Syntax

Sub AddCurrentRange (start, end, rangeInfo As CRRangeInfo)

Parameters

Parameter
Description
start
Sets start of the value range.
end
Sets end of the value range.
rangeInfo
CRRangeInfo
. Use this bitwise value to indicate whether the upper and/or lower bound of the range should be included.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddCurrentValue Method (ParameterFieldDefinition Object)

The AddCurrentValue method adds a value to the specified parameter field of a report. When this method is used, property DiscreteOrRangeKind must be crDiscreteValue.

Syntax

Sub AddCurrentValue (CurrentValue)

Parameter

Parameter
Description
CurrentValue
Specifies the current value to be added.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddDefaultValue Method (ParameterFieldDefinition Object)

The AddDefaultValue method adds a value to the group of default values for a specified parameter in a report. The default value set should fall within the scope of properties EditMask and MaximumValue and MinimumValue, if set. Use this method instead of SetDefaultValue if the parameter field allows multiple values.

Syntax

Sub AddDefaultValue (DefaultValue)

Parameter

Parameter
Description
DefaultValue
Specifies the default value to be added.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ClearCurrentValueAndRange Method (ParameterFieldDefinition Object)

The ClearCurrentValueAndRange method clears the specified parameter field of all current values and ranges.

Syntax

Sub ClearCurrentValueAndRange ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DeleteNthDefaultValue Method (ParameterFieldDefinition Object)

The DeleteNthDefaultValue method deletes the nth default value of the parameter field.

Syntax

Sub DeleteNthDefaultValue(index As Integer)

Parameter

Parameter
Description
index
Index of the value to be deleted.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetNthCurrentRange Method (ParameterFieldDefinition Object)

The GetNthCurrentRange method retrieves a value range from the specified parameter field in a report.

Syntax

Sub GetNthCurrentRange (index As Integer, pStart, pEnd,

    pRangeInfo As CRRangeInfo)

Parameters

Parameter
Description
index
Index of the value range to be retrieved.
pStart
Sets start of the value range.
pEnd
Sets end of the value range.
pRangeInfo
CRRangeInfo
. Use this bitwise value to indicate whether the upper and/or lower bound of the range should be included.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetNthCurrentValue Method (ParameterFieldDefinition Object)

The GetNthCurrentValue method returns a value from the specified parameter field of a report.

Syntax

Function GetNthCurrentValue (index As Integer)

Parameter

Parameter
Description
index
Index number of the current value to be retrieved.
Returns

Returns the current value specified by the index parameter.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetNthDefaultValue Method (ParameterFieldDefinition Object)

Get NthDefaultValue method retrieves a default value for a specified parameter field in a report.

Syntax

Function GetNthDefaultValue (index As Integer)

Parameter

Parameter
Description
index
The index number of the default value to be retrieved.
Returns

Returns the default value specified by the index parameter.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetNthDefaultValue Method (ParameterFieldDefinition Object)

The SetNthDefaultValue method sets a default value for a specified parameter field in a report. The default value set should fall within range and property EditMask if a string field, if set.

Syntax

Sub SetNthDefaultValue (index As Integer, nthDefaultValue)

Parameters

Parameter
Description
index
The index number of the default value to be set.
nthDefaultValue
Specifies the default value that you want to set for parameter field.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ParameterFieldDefinitions Collection

The ParameterFieldDefinitions Collection is a collection of parameter fields in the report. If the report contains any subreports, parameter fields in the subreports will also be included in the collection. Access a specific ParameterFieldDefinition.

ParameterFieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of parameter fields in the collection.
Read only
None
Item (index As
Long)
ParameterFieldDefinition Object
. Gets the item in the Collection specified by parameter index.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Remarks

Item is a default property. You can reference a parameter field directly, for example, ParameterFieldDefinitions(1).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ParameterFieldDefinitions Collection Methods

The following methods are discussed in this section:

Add Method (ParameterFieldDefinitions Collection)

Delete Method (ParameterFieldDefinitions Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (ParameterFieldDefinitions Collection)

Use Add method to add a ParameterFieldDefinition Object, to the ParameterFieldDefinitions Collection.

Syntax

Function Add (parameterName As String, ValueType As CRFieldValueType

     As ParameterFieldDefinition

Parameters

Parameter
Description
parameterName
Specifies the parameter name.
ValueType
CRFieldValueType
. Specifies the value type of the field.
Returns

Returns the ParameterFieldDefinition Object added to the Collection

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (ParameterFieldDefinitions Collection)

Use Delete method to remove a ParameterFieldDefinition Object from the Collection.

Syntax

Sub Delete (index)

Parameter

Parameter
Description
index
Specifies the index number of the item that you want to delete from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PrintingStatus Object

The PrintingStatus Object provides properties for retrieving information and setting options for the printing status of a report (for example, number of pages, latest page to be printed, etc.). A PrintingStatus Object is obtained from the PrintingStatus property of the Report Object.

PrintingStatus Object Properties

Property
Description
Read/Write
Restriction in
event handler
NumberOfPages
Long. Gets the total number of pages in the report.
Read only
None
NumberOfRecord
Printed
Long. Gets the number of records printed.
Read only
None
NumberOfRecordRead
Long. Gets the number of records read.
Read only
None
NumberOfRecord
Selected
Long. Gets the number of records selected.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Progress
CRPrintingProgress
. Gets the printing progress.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Object

A report corresponds to a print job in the Crystal Report Engine. When the report object is destroyed, or goes out of focus, it closes the print job. It holds on to Application Object. When a Report Object gets destroyed, it releases the application.

Access to the Report Object is dependent on the object variable you create. If the object variable goes out of scope, you will lose access to the Report Object and, therefore, the report. You may want to declare your Report Object variable as Global.

Report Object Properties

Property
Description
Read/Write
Restriction in
event handler
Application
Application Object
. Gets reference to the Application Object that the Report Object is associated with.
Read only
None
Application
Name
String. Gets or sets the application name.
Read/Write
None
Areas
Areas Collection
. Gets reference to the Areas Collection, a collection of all the areas in the report which can be indexed by a number or by a string, such as "RH", "GF1". The areas are in the same order as on the Crystal Reports Design Tab. For Example: RH, PH, GH1,...GHn, D, GFn,...GF1, RF, PF. The abbreviations for areas are case sensitive.
Read only
None
BottomMargin
Long. Gets or sets the page bottom margin, in twips.
Read/Write
Can be written only when formatting idle.
CanPerform
GroupingOn
Server
Boolean. Gets whether the report can perform grouping on the server.
Read only
None
CaseInsensitive
SQLData
Boolean. Gets or sets the report option that indicates whether the SQL data used in the report becomes case sensitive.
Read/Write
Can be written only when formatting idle.
ConvertDate
TimeType
CRConvertDateTimeType
. Gets or sets the report option that specifies the format to be converted for date/time fields.
Read/Write
Can be written only when formatting idle.
ConvertNull
FieldToDefault
Boolean. Gets or sets the report option that indicates whether to convert any null values to the database field default.
Read/Write
Can be written only when formatting idle.
Database
Database Object
. Gets reference to the Database Object which represents the database used in the report.
Read only
None
DisplayProgress
Dialog
Boolean. Enable or disable the progress dialog.
Read/Write
Can be written only when formatting idle.
DriverName
String. Gets the printer driver name used by the current report. Gets an empty string if default printer is used.
Read only
Can be written only when formatting idle.
EnableAsync
Query
Boolean. Gets or sets the enable AsyncQuery
Read/Write
Can be written only when formatting idle.
EnableGenerating
DataForHidden
Object
Boolean. Gets or sets the Enable Generating Data For Hidden Object option.
Read/Write
Can be written only when formatting idle.
EnableParameter
Prompting
Boolean. Gets or sets the prompting for parameter fields option.
Read/Write
Can be written only when formatting idle.
EnablePerform
QueriesAsynchronously
Boolean. Gets or sets the perform queries asynchronously option
Read/Write
Can be written only when formatting idle.
EnableSelectDistinct
Records
Boolean. Gets or sets the select distinct records option
Read/Write
Can be written only when formatting idle.
ExportOptions
ExportOptions Object
. Gets reference to ExportOptions Object for the report.
Read only
None
FieldMapping
Type
CRFieldMappingType
. Gets or sets the field mapping type.
Read/Write
Can be written only when formatting idle.
FormulaFields
FormulaFieldDefinitions Collection
. Gets reference to Collection of all the named FormulaFieldDefinitions defined in the Report.
Read only
None
FormulaSyntax
CRFormulaSyntax
. Gets or sets report formula syntax.
Read/Write
Can be written only when formatting idle.
GroupName
Fields
GroupNameFieldDefinitions Collection
. Gets reference to a collection of all the group name fields defined in the report.
Read only
None
GroupSelection
Formula
String. Gets or sets the group selection formula.
Read/Write
Can be written only when formatting idle.
GroupSortFields
SortFields Collection
. Gets reference to group sort field collection.
Read only
None
HasSavedData
Boolean. Gets whether the report has data saved in memory.
Read only
None
KeywordsIn
Report
String. Gets or sets the keywords in the report.
Read/Write
Can be written only when formatting idle.
Kind
CRReportKind
. Gets what kind of report.
Read only
None
LastGetFormula
Syntax
CRFormulaSyntax
. Gets the formula syntax of the last formula text returned.
Read only
None
LeftMargin
Long. Gets or sets the page left margin, in twips.
Read/Write
Can be written only when formatting idle.
MorePrintEngine
ErrorMessages
Boolean. Gets or sets the report option that indicates whether to pop up database error dialogs during printing when a Report Engine error occurs.
Read/Write
Can be written only when formatting idle.
NumberOfGroup
Long. Gets the number of groups in the report.
Read only
None
PageEngine
PageEngine Object
. Gets reference to the PageEngine object.
Read only
None
PaperOrientation
CRPaperOrientation
. Gets or sets the current printer paper orientation. For the default printer, crDefaultPaperOrientation is returned.
Read/Write
Can be written only when formatting idle.
PaperSize
CRPaperSize
. Gets or sets the current printer paper size. For the default printer, crDefaultPaperSize is returned.
Read/Write
Can be read or written only when formatting idle.
PaperSource
CRPaperSource
. Gets or sets the current printer paper source.
Read/Write
Can be written only when formatting idle.
ParameterFields
ParameterFieldDefinitions Collection
. Gets reference to the collection of all the ParameterFieldDefinitions defined in the report. This property will return parameter fields found in the main report as well as any subreports included in the report (for example, if the main report has 3 parameters and a subreport included within the report has an additional 2 parameters, the number of parameter fields in the collection returned by Report.ParameterFields would be 5).
Read only
None
Parent
Report Object
. Gets reference to the parent object for subreports.  (NULL for main report).
Read only
None
PerformGrouping
OnServer
Boolean. Gets or sets the performing grouping on server option.
Read/Write
Can be written only when formatting idle.
PortName
String. Gets the printer port name used by the current report. Gets an empty string if the default printer is used.
Read only
None
PrintDate
Date. Gets or sets the print date for the report. By default, the current date will be used.
Read/Write
Can be written only when formatting idle.
PrinterDuplex
CRPrinterDuplexType
. Gets or sets the current printer duplex option.
Read/Write
Can be written only when formatting idle.
PrinterName
String. Gets the printer name used by the report. Gets an empty string if the default printer is used.
Read only
None
PrintingStatus
PrintingStatus Object
. Gets PrintingStatus Object for the report.
Read only
None
RecordSelection
Formula
String. Gets or sets record selection formula.
Read/Write
Can be written only when formatting idle.
RecordSortFields
SortFields Collection
. Gets a collection of record sort fields.
Read only
None
ReportAlerts
ReportAlerts Collection
. Gets reference to Collection of all the named Report Alerts defined in the Report.
Read only
None
ReportAuthor
String. Gets or sets the report author.
Read/Write
Can be written only when formatting idle.
ReportComments
String. Gets or sets report comments.
Read/Write
Can be written only when formatting idle.
ReportSubject
String. Gets or sets the report subject.
Read/Write
Can be written only when formatting idle.
ReportTemplate
String. Gets or sets the report template.
Read/Write
Can be written only when formatting idle.
ReportTitle
String. Gets or sets the report title.
Read/Write
Can be written only when formatting idle.
RightMargin
Long. Gets or sets the page right margin, in twips.
Read/Write
Can be written only when formatting idle.
RunningTotal
Fields
RunningTotalFieldDefinitions Collection
. Gets running total fields collection.
Read only
None
SavePreview
Picture
Boolean. Gets or sets save preview picture with report option.
Read/Write
None
Sections
Sections Collection
. Gets collection of all the sections in the report.
Read only
None
SQLExpression
Fields
SQLExpressionFieldDefinitions Collection
. Gets SQL expression field collection.
Read only
None
SQLQueryString
String. Gets or sets SQL query string.
Read/Write
Can be written only when formatting idle.
SummaryFields
SummaryFieldDefinitions Collection
. Gets  collection for group and report summaries (cross-tab summaries not available using this property).
Read only
None
TopMargin
Long. Gets or sets the page top margin, in twips.
Read/Write
Can be written only when formatting idle.
TranslateDos
Memos
Boolean. Gets or sets the report option that indicates whether to translate DOS memos.
Read/Write
Can be written only when formatting idle.
TranslateDos
Strings
Boolean. Gets or sets the report option that indicates whether to translate DOS strings.
Read/Write
Can be written only when formatting idle.
UseIndexFor
Speed
Boolean. Gets or sets the use index for speed during record selection report option.
Read/Write
Can be written only when formatting idle.
VerifyOnEvery
Print
Boolean. Gets or sets the report option that indicates whether to verify the database every time the report is printed.
Read/Write
Can be written only when formatting idle.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Object Methods

The following methods are discussed in this section:

AddGroup Method (Report Object)—RDC Object Model

AddReportVariable Method (Report Object)

AutoSetUnboundFieldSource Method (Report Object)

CancelPrinting Method (Report Object)

DeleteGroup Method (Report Object)

DiscardSavedData Method (Report Object)

Export Method (Report Object)

GetNextRows Method (Report Object)

GetReportVariableValue Method (Report Object)

OpenSubreport Method (Report Object)

PrinterSetup Method (Report Object)

PrintOut Method (Report Object)

ReadRecords Method (Report Object)

SaveAs Method (Report Object)

SelectPrinter Method (Report Object)

SetDialogParentWindow Method (Report Object)

SetReportVariableValue Method (Report Object)

SetUnboundFieldSource Method (FieldObject Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddGroup Method (Report Object)—RDC Object Model

The AddGroup Method adds a group to the report. ConditionField indicates the field for grouping, Condition indicates a change in a field value that generates a grouping, and SortDirection specifies the direction in which groups are sorted.

Syntax

Sub AddGroup (GroupNumber As Integer, pConditionField As Object,

    Condition As CRGroupCondition, SortDirection As CRSortDirection)

Parameters

Parameter
Description
GroupNumber
Specifies the number of the group to be added (the position of the group in relation to existing groups). For example, to add a group to the first position, set GroupNumber=1.
pConditionField
Specifies the field to be grouped. The field can be a database field definition object or the field name
condition
CRGroupCondition
. Specifies CRGroupCondition (see table below) indicating the grouping condition (that is, group on any value).
SortDirection
CRSortDirection
. Specifies the sort direction for the group.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddReportVariable Method (Report Object)

Use AddReportVariable method to add a report variable to the report. This variable can then be used to provide a calculated field value in the Format Event. You can add as many report variables to your report as you need. Each report variable is identified by its name, which must be unique.

Syntax

Sub AddReportVariable (type As CRReportVariableValueType,

    pName As String, [arraySize As Long], [reserved])

Parameters

Parameter
Description
type
CRReportVariableValueType
. Specifies the type of variable that you want to add to the report.
pName
Specifies the unique name for the report variable that you want to add.
[arraySize As Long]
Reserved. Do not use.
[reserved]
Reserved. Do not use.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


 AutoSetUnboundFieldSource Method (Report Object)

Use AutoSetUnboundFieldSource method to automatically bind unbound report fields to database fields based on the unbound field’s name or name and value type.

Syntax

Sub AutoSetUnboundFieldSource (matchType As CRBindingMatchType,

    [bindSubReports])

Parameters

Parameter
Description
matchType
CRBindingMatchType
. Specifies whether to match name alone or name and data type.
[bindSubReports]
Specifies whether or not to bind subreport unbound fields.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CancelPrinting Method (Report Object)

Use CancelPrinting method to cancel the printing of a report.

Syntax

Sub CancelPrinting ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DeleteGroup Method (Report Object)

Use DeleteGroup method to remove a group from a report.

Syntax

Sub DeleteGroup (GroupNumber As Integer)

Parameter

Parameter
Description
GroupNumber
Specifies the index number of the group that you want to delete from the report.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DiscardSavedData Method (Report Object)

Use DiscardSavedData method to discard any saved data with the report before previewing. This method can be invoked only when in formatting idle mode.

Syntax

Sub DiscardSavedData ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Export Method (Report Object)

Use Export method to export reports to a format and destination specified with ExportOptions Object.

Syntax

Sub Export ([promptUser])

Parameters

Parameter
Description
[promptUser]
Specifies Boolean value indicating if user should be prompted for export options. If you don’t want to prompt the user, then you must set all necessary export options. The application will prompt automatically for any missing export options, even if promptUser = FALSE. Default value = TRUE (prompt user).
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetNextRows Method (Report Object)

Use GetNextRows method to get the specified rowset.

Syntax

Function GetNextRows (startRowN As Long, pRowN As Long)

Parameters

Parameter
Description
startRowN
Specifies the row number to start the rowset on.
pRowN
Specifies the number of rows to return to the rowset.
Returns

Returns the specified rowset.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetReportVariableValue Method (Report Object)

Use GetReportVariableValue method to get the value of the specified uniquely named report variable. This call can only be made in the formatting active mode.

Syntax

Function GetReportVariableValue (pName As String)

Parameters

Parameter
Description
pName
Specifies the unique name of the report variable for which you want to get the value.
Returns

Returns value of the specified report variable.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OpenSubreport Method (Report Object)

The OpenSubreport method opens a subreport contained in the report and returns a Report Object corresponding to the named subreport.

Syntax

Function OpenSubreport (pSubreportName As String) As Report

Parameter

Parameter
Description
pSubreportName
Specifies the file name of the subreport to be opened.
Returns

Returns the specified subreport as a Report Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PrinterSetup Method (Report Object)

Use PrinterSetup method to open the printer setup dialog box so that the user can change printers or printer settings for the report.

Syntax

Sub PrinterSetup (hWnd As Long)

Parameter

Parameter
Description
hWnd
Specifies the handle of the printer setup dialog box parent window. If you pass 0, the top level application window will be the parent.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PrintOut Method (Report Object)

Use PrintOut method to print out the specified pages of the report to the printer selected using the SelectPrinter Method (Report Object). If no printer is selected, the default printer specified in the report will be used. This method can be invoked only when in formatting idle mode.

Syntax

Sub PrintOut ([promptUser], [numberOfCopy], [collated],

    [startPageN], [stopPageN])

Parameters

Parameter
Description
[promptUser]
Specifies Boolean value indicating if the user should be prompted for printer options.
[numberOfCopy]
Specifies the number of report copies you want printed.
[collated]
Specifies Boolean value specifying whether or not you want the report copies collated.
[startPageN]
Specifies the first page that you want printed.
[stopPageN]
Specifies the last page that you want printed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ReadRecords Method (Report Object)

Use ReadRecords method to force the report to read all records in the report from the database.

Syntax

Sub ReadRecords ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SaveAs Method (Report Object)

Use SaveAs method to save a report with the ability to specify Crystal Reports 8 or 7 version file format. The user can specify which format to use when saving the report. This call can only be made in formatting idle mode.

Syntax

Sub SaveAs (pFilePath As String, fileFormat As CRReportFileFormat)

Parameters

Parameter
Description
pFilePath
Specifies the file path and name that you want to use to save the report.
fileFormat
CRReportFileFormat
. Specifies the file format that you want to use to save the report.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SelectPrinter Method (Report Object)

The SelectPrinter method selects a different printer for the report. This method can be invoked only when in formatting idle mode.

Syntax

Sub SelectPrinter (pDriverName As String, pPrinterName As String, pPortName As String)

Parameters

Parameter
Description
pDriverName
Specifies the name of the printer driver for the selected printer.
pPrinterName
Specifies the printer name for the selected printer.
pPortName
Specifies the port name for the port to which the selected printer is attached.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetDialogParentWindow Method (Report Object)

The SetDialogParentWindow method sets the dialog parent window.

Syntax

Sub SetDialogParentWindow (hWnd As Long)

Parameter

Parameter
Description
hWnd
Specifies the handle of the parent window.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetReportVariableValue Method (Report Object)

Use SetReportVariableValue method to set the value of a report variable into the Print Engine. The report variable is designed to be used in Format Event to do calculated fields. However, you should not depend on how many times an event is fired to do total calculations -- make sure that the calculation for the report variable is correct. The Print Engine keeps track of the status. This call can me made only in formatting active mode.

Syntax

Sub SetReportVariableValue (pName As String, var)

Parameters

Property
Description
pName
Specifies the name of the variable for which you want to set the value.
var
Specifies the value that you want to set.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Object Events

The following events are discussed in this section:

AfterFormatPage Event (Report Object)

BeforeFormatPage Event (Report Object)

FieldMapping Event (Report Object)

NoData Event (Report Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AfterFormatPage Event (Report Object)

The AfterFormatPage event is fired after formatting a page.

Syntax

Event AfterFormatPage (PageNumber As Long)

Parameter

Parameter
Description
PageNumber
Specifies the number of the report page triggering the event.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


BeforeFormatPage Event (Report Object)

The BeforeFormatPage event is fired before formatting a page.

Syntax

Event BeforeFormatPage (PageNumber As Long)

Parameter

Parameter
Description
PageNumber
Specifies the number of the report page triggering the event.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldMapping Event (Report Object)

The FieldMapping event fires if the database is changed while verifying database.

Syntax

Event FieldMapping (reportFieldArray, databaseFieldArray,

    useDefault As Boolean)

Parameters

Parameter
Description
reportFieldArray
Specifies the report field array to map.
databaseFieldArray
Specifies the database field array to map.
useDefault
If TRUE, the values passed with parameters reportFieldArray and databaseFieldArray will be ignored and the default values used; if FALSE, the values passed with reportFieldArray and databaseFieldArray will be used.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


NoData Event (Report Object)

The NoData event fires when there is no data for the report.

Syntax

Event NoData (pCancel As Boolean)

Parameter

Parameter
Description
pCancel
Specifies whether to cancel the report.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ReportAlert Object

The ReportAlert object represents a Report Alert contained in a report. This object provides properties for getting and setting information on Report Alerts in the report.

Report Alerts are custom messages created in either the Crystal Reports Designer, the Report Designer Component, or the Embeddable Crystal Reports Designer Control. Report Alerts may indicate action to be taken by the user or information about report data. ReportAlert Object Properties. For more information see Report Alerts in the Crystal Reports User Guide.

ReportAlert Object Properties

Property
Definition
Read/Write
Restriction in
event handler
AlertInstances
ReportAlertInstances Collection
. Gets a reference to a collection of all the Report Alert instances created when the Report Alert is run.
Read only
None
ConditionFormula
String. Gets or sets the condition formula for the Report Alert. The condition formula can be based on recurring records or on summary fields, but cannot be based on print-time fields, such as running totals or print time formulas. Condition formulas cannot have shared variables.
Read/Write
Can be written only when formatting idle.
DefaultMessage
String. Gets or sets the default message for the Report Alert.
Read/Write
Can be written only when formatting idle.
IsEnabled
Boolean. Gets or sets wether or not the Report Alert is enabled.
Read/Write
Can be written only when formatting idle
MessageFormula
String. Gets or sets the message when the Report Alert is triggered. The result of the formula must be a string, and is created by combining a string with a report field. If MessageFormula is set it will override the value set for DefaultMessage.
Read/Write
Can be written only when formatting idle
Name
String. Gets or sets the name of the Report Alert.
Read/Write
Can be written only when formatting idle
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ReportAlerts Collection

The ReportAlerts collection contains the Report Alert objects defined in a report. Access a specific ReportAlert Object, in the collection using the Item property.

ReportAlerts Collection Properties

Property
Definition
Read/Write
Restriction in
event handler
Count
Long. Gets the number of
ReportAlert Object
, in the collection.
Read only
None
Item (index
As Long)
ReportAlert Object
. Gets an item from the Collection. Item has an index parameter that is a 1-based index (for example, Item(1) for the first Report Alert in the collection). The items in the collection are indexed in the order that they were added to the report.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
ReportAlerts Collection Methods

The following methods are discussed in this section:

Add Method (ReportAlerts Collection)

Delete Method (ReportAlerts Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (ReportAlerts Collection)

The Add method is used to add a Report Alert object to the report.

Syntax

Function Add (Name As String, DefaultMessage As String, IsEnabled As Boolean, ConditionFormula As String, [MessageFormula as String]) As ReportAlert

Parameter
Description
Name
Specifies the name of the Report Alert.
DefaultMessage
Specifies the default message created by the Report Alert.
IsEnabled
Specifies wether or not the Report Alert is enabled when the report is run.
ConditionFormula
Specifies the conditional formula that evaluates when the Report Alert is triggered.
MessageFormula
Optional. Formula used to create the message when the Report Alert is triggered. The result of the formula must be a string, and is created by combining a string with a report field. If MessageFormula is set it will override the value set for DefaultMessage.
Sample

In this example a report is grouped by country and contains a summary of last year’s sales per country. The Report Alert will be triggered when the summary of last year’s sales exceeds $25,000.00. When the Report Alert is triggered a message is created from the default message and the country name.

Dim name, defaultMessage, conditionFormula, messageFormula As String

'Name of the Report Alert

name = "Sales Alert"

defaultMessage = "Great sales in "

'Conditional formula used to evaluate the Report Alert

conditionFormula = "Sum ({Customer.Last Year's Sales}, {Customer.Country}) > 25000"

'Replaces the default message set for the Report Alert. The message is

'created in a formula by concatenating the value set in the

'DefaultMessage parameter, and the group name of the country that

'triggers the Report Alert.

'DefaultAttribute is a function used by the Formula Editor to return

'the default message set for the Report Alert.

messageFormula = "DefaultAttribute & GroupName ({Customer.Country})"

Report.ReportAlerts.Add _

name, defaultMessage, True, conditionFormula, messageFormula

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (ReportAlerts Collection)

Use Delete method to remove a ReportAlert Object from the Collection.

Syntax

Sub Delete (index)

Parameter

Parameter
Description
index
Specifies the index number of the Object that you want to remove from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ReportAlertInstance Object

A ReportAlertInstance object is created each time a Report Alert is triggered. This object contains a property for getting the message created for that specific instance of the Report Alert.

Note: In the present build only the first ReportAlertInstance is created at runtime. This limitation will be addressed in a future release.

ReportAlertInstance Object Properties

Property
Definition
Read/Write
Restriction in
event handler
AlertMessage
String. Gets the message returned at the time the Report Alert was triggered.
Read only
None
Parent
ReportAlert Object
. Gets reference to the parent object.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ReportAlertInstances Collection

The ReportAlertInstances collection contains the ReportAlertInstance objects created when a Report Alert is triggered. Access a specific ReportAlertInstance Object, in the collection using the Item property.

Note: In the present build only the first ReportAlertInstance is created at runtime. This limitation will be addressed in a future release.

ReportAlertInstances Properties

Property
Definition
Read/Write
Restriction in
event handler
Count
Long. Gets the number of
ReportAlertInstance Object
, in the collection.
Read only
None
Item (index
As Long)
ReportAlertInstance Object
. Gets an item from the Collection. Item has an index parameter that is a 1-based index (for example, Item(1) for the first ReportAlertInstance in the collection). The items in the collection are indexed in the order that they were added to the report.
Note:
In the present build only the first ReportAlertInstance is created at runtime. This limitation will be addressed in a future release.
Read only
None
Parent
ReportAlert Object
. Gets reference to the parent object.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ReportObjects Collection

The ReportObjects Collection is a collection of report objects in a section. Report objects can be a field, text, OLE, cross-tab, subreport, BLOB field, Box, Graph, Line, Map, or OlapGrid objects. Access a specific object in the collection using the Item property.

ReportObjects Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of report objects in the collection.
Read only
None
Item (index)
 As Object
Gets a report object. Depending on the type of item referenced, this can be a
BlobFieldObject Object
,
FieldObject Object
,
TextObject Object
,
Page Object
,
CrossTabObject Object
,
SubreportLinks Collection
,
BoxObject Object
,
GraphObject Object
,
LineObject Object
,
MapObject Object
,
OlapGridObject Object
. Item has an index parameter that is a numeric, 1-based index (that is, Item (1)). The items in the collection are indexed in the order they were added to the report.
Read only
None
Parent
Section Object
. Gets reference to the parent object.
Read only
None
Remarks

Item is a default property. You can reference a report object directly, for example, ReportObjects(1).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RunningTotalFieldDefinition Object

The RunningTotalFieldDefinition Object represents a running total field used in the report. This object provides properties for getting information on running total fields in the report.

RunningTotalFieldDefinition Object Properties

Property
Definition
Read/Write
Restriction in
event handler
Evaluate
Condition
CRRunningTotalCondition
. Gets evaluate condition.
Read only
None
Evaluate
ConditionField
Object. Gets evaluate condition field.
Read only
None
Evaluate
ConditionFormula
String. Gets or sets evaluate condition formula.
Read/Write
Can be written only when formatting idle.
Evaluate
GroupNumber
Integer. Gets or sets evaluate group number.
Read/Write
Can be written only when formatting idle.
Hierarchical
SummaryType
CRHierarchicalSummaryType
. Gets or sets wether or not to calculate the running total across the hierarchy in a hierarchically grouped report.
Read/Write
Can be written only when formatting idle.
Kind
CRFieldKind
. Gets which kind of field (that is, database, summary, formula, etc.).
Read only
None
Name
String. Gets the unique formula name of the field within the report (table.FIELD). For example, {#Test}.
Read only
None
NextValue
Variant. Gets the field next value.
Read only
Can be read only when top-level Report object is formatting active.
NumberOfBytes
Integer. Gets the number of bytes required to store the field data in memory.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PreviousValue
Variant. Gets the field previous value.
Read only
Can be read only when top-level Report object is formatting active.
ResetCondition
CRRunningTotalCondition
. Gets the reset condition.
Read only
None
ResetCondition
Field
Object. Gets reset condition field.
Read only
None
ResetConditionFormula
String. Gets or sets the reset condition formula.
Read/Write
Can be written only when formatting idle.
ResetGroupNumber
Integer. Gets or sets the reset group number.
Read/Write
Can be written only when formatting idle.
RunningTotal
FieldName
String. Gets the running total field name.
Read only
None
Secondary
SummarizedField
Object. Gets the secondary summarized field
Read only
Can be written only when formatting idle.
SummarizedField
Object. Gets the summarized field.
Read only
Can be written only when formatting idle.
Summary
OperationParameter
Long. Gets or sets summary operation parameter.
Read/Write
Can be written only when formatting idle.
SummaryType
CRSummaryType
. Gets or sets summary type.
Read/Write
Can be written only when formatting idle.
Value
Variant. Gets the field current value.
Read only
Can be read only when top-level Report object is formatting active.
ValueType
CRFieldValueType
. Gets which type of value is found in the field.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RunningTotalFieldDefinition Object Methods

The following methods are discussed in this section:

SetEvaluateConditionField Method (RunningTotalFieldDefinition Object)

SetNoEvaluateCondition Method (RunningTotalFieldDefinition Object)

SetNoResetCondition Method (RunningTotalFieldDefinition Object)

SetResetConditionField Method (RunningTotalFieldDefinition Object)

SetSecondarySummarizedField Method (RunningTotalFieldDefinition Object)

SetSummarizedField Method (RunningTotalFieldDefinition Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetEvaluateConditionField Method (RunningTotalFieldDefinition Object)

Use SetEvaluateConditionField to set the evaluate condition field.

Syntax

Sub SetEvaluateConditionField (pEvaluateConditionField)

Parameter

Parameter
Description
pEvaluateConditionField
Specifies the condition field that you want to use.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetNoEvaluateCondition Method (RunningTotalFieldDefinition Object)

Use SetNoEvaluateCondition method to specify no evaluate condition for the RunningTotalFieldDefinition Object.

Syntax

Sub SetNoEvaluateCondition ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetNoResetCondition Method (RunningTotalFieldDefinition Object)

Use SetNoResetCondition method to specify no reset condition for the RunningTotalFieldDefinition Object.

Syntax

Sub SetNoResetCondition ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetResetConditionField Method (RunningTotalFieldDefinition Object)

Use SetResetConditionField to specify the reset condition field to use with the RunningTotalFieldDefinition Object.

Syntax

Sub SetResetConditionField (pResetConditionField)

Parameter

Parameter
Description
pResetConditionField
Specifies the condition field that you want to use.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetSecondarySummarizedField Method (RunningTotalFieldDefinition Object)

Use SetSecondarySummarizedField method to specify which condition field you want to use as the second summarized field for the RunningTotalFieldDefinition Object.

Syntax

Sub SetSecondarySummarizedField (secondarySummariedField)

Parameter

Parameter
Description
secondarySummariedField
Specifies the condition field that you want to use.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetSummarizedField Method (RunningTotalFieldDefinition Object)

Use SetSummarizedField method to specify a second summarized field for the RunningTotalFieldDefinition Object.

Syntax

Sub SetSummarizedField (SummarizedField)

Parameter

Parameter
Description
SummarizedField
Specifies the condition field that you want to use.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RunningTotalFieldDefinitions Collection

The RunningTotalFieldDefinitions Collection is a collection of running total field definition objects. One object exists in the collection for every running total field accessed by the report. Access a specific RunningTotalFieldDefinition Object, in the collection using the Item property.

RunningTotalFieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of
RunningTotalFieldDefinition Object
, in the collection.
Read only
None
Item (index
As Long)
RunningTotalFieldDefinition Object
. Gets an item from the Collection. Item has an index parameter that is a 1-based index (for example, Item(1) for the first database field in the collection). The items in the collection are indexed in the order that they were added to the report.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a database directly, for example, RunningTotalFieldDefinitions(1).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RunningTotalFieldDefinitions Collection Methods

The following methods are discussed in this section:

Add Method (RunningTotalFieldDefinitions Collection)

Delete Method (RunningTotalFieldDefinitions Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (RunningTotalFieldDefinitions Collection)

Use Add method to add a RunningTotalFieldDefinition Object to the Collection.

Syntax

Function Add (runningTotalName As String) As RunningTotalFieldDefinition

Parameter

Parameter
Description
runningTotalName
Specifies the name of the RunningTotal field that you want to add.
Returns

Returns a RunningTotalFieldDefinition Object member of the Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (RunningTotalFieldDefinitions Collection)

Use Delete method to remove a RunningTotalFieldDefinition Object from the Collection.

Syntax

Sub Delete (index)

Parameter

Parameter
Description
index
Specifies the index number of the Object that you want to remove from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Section Object

Report areas contain at least one section. The Section Object includes properties for accessing information regarding a section of your report. This object holds on to a report object, then releases the report object when it is destroyed.

Section Object Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the section background color.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets the height of the section, in twips.
Read/Write
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the option that indicates whether to keep the entire section on the same page if it is split into two pages.
Read/Write
Can be written only when formatting idle or active.
MinimumHeight
Long. Gets the minimum section height, in twips.
Read only
None
Name
String. Gets or sets the name of the section.
Read/Write
Can be written only when formatting idle.
NewPageAfter
Boolean. Gets or sets the option that indicates whether to start a new page after the current section.
Read/Write
Can be written only when formatting idle or active.
NewPageBefore
Boolean. Gets or sets the option that indicates whether to start a new page before the current section.
Read/Write
Can be written only when formatting idle or active.
Number
Integer. Gets the index number associated with the section in the area (for example, if the first section in an area, the number returned is 1).
Read only
None
Parent
Area Object
. Gets reference to the parent object.
Read only
None
PrintAtBottomOf
Page
Boolean. Gets or sets the option that indicates whether to print the current section at the bottom of the page.
Read/Write
Can be written only when formatting idle or active.
ReportObjects
ReportObjects Collection
. Gets reference to the heterogeneous collection of report objects for the section.
Read only
None
ResetPage
NumberAfter
Boolean. Gets or sets the option that indicates whether to reset the page number after the current section.
Read/Write
Can be written only when formatting idle or active.
Suppress
Boolean. Gets or sets the section visibility.
Read/Write
Can be written only when formatting idle or active.
SuppressIfBlank
Boolean. Gets or sets the option that indicates whether to suppress the current section if it is blank.
Read/Write
Can be written only when formatting idle or active.
UnderlaySection
Boolean. Gets or sets the underlay following section option.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets the width of the section, in twips.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Section Object Methods

The following methods are discussed in this section:

AddBlobFieldObject Method (Section Object)

AddBoxObject Method (Section Object)

AddCrossTabObject Method (Section Object)

AddFieldObject Method (Section Object)

AddGraphObject Method (Section Object)

AddLineObject Method (Section Object)

AddPictureObject Method (Section Object)

AddSpecialVarFieldObject Method (Section Object)

AddSubreportObject Method (Section Object)

AddSummaryFieldObject Method (Section Object)

AddTextObject Method (Section Object)

AddUnboundFieldObject Method (Section Object)

DeleteObject Method (Section Object)

ImportSubreport Method (Section Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Section Object Events

Format Event (Section Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddBlobFieldObject Method (Section Object)

The AddBlobFieldObject method adds a BlobFieldObject Object to the Section Object.

Syntax

Function AddBlobFieldObject (Field, Left As Long, Top As Long

    As BlobFieldObject

Parameters

Parameter
Description
Field
Variant. Can be formula form name or any field definition that specifies the field that you want to add.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Returns

Returns a BlobFieldObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddBoxObject Method (Section Object)

The BoxObject method adds a BoxObject Object to the Section Object.

Syntax

Function AddBoxObject (Left As Long, Top As Long, Right As Long,

    Bottom As Long, [pEndSection]) As BoxObject

Parameters

Parameter
Description
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Right
Specifies the offset of the bottom right corner of the Object that you are adding relative to the bottom right corner of the parent (or end) Section, in twips.
Bottom
Specifies the offset of the bottom right corner of theObject that you are adding relative to the bottom right corner of the parent (or end) Section, in twips.
[pEndSection]
Specifies the Section in which the end of the BoxObject will be placed, if not the parent Section.
Returns

Returns a BoxObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddCrossTabObject Method (Section Object)

The AddCrossTabObject method adds a CrossTabObject Object to the Section Object. This method creates an empty CrossTabObject. Use the CrossTabObject properties and methods to add grouping and summary info.

Syntax

Function AddCrossTabObject (Left As Long, Top As Long) As CrossTabObject

Parameters

Parameter
Description
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Returns

Returns a CrossTabObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddFieldObject Method (Section Object)

The AddFieldObject method adds a FieldObject Object to the Section Object. The FieldObject can be reference to a database field definition, formula field definition, running total field definition, SQL expression field definition, or parameter field definition.

Syntax

Function AddFieldObject (Field, Left As Long, Top As Long) As FieldObject

Parameters

Parameter
Description
Field
Specifies the field that you want to add to the Section.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Returns

Returns a FieldObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddGraphObject Method (Section Object)

The AddGraphObject method adds a GraphObject Object (Chart) to the Section Object. The inserted GraphObject is empty. Use the GraphObject properties and methods to add data, groups and settings. If optional parameter [pCrossTabObject] is passed, you can insert a CrossTab Chart.

Syntax

Function AddGraphObject (graphDataType As CRGraphDataType,

    Left As Long, Top As Long, [pCrossTabObject]) As GraphObject

Parameters

Parameter
Description
graphDataType
CRGraphDataType
. Specifies the data type for the graph that you want to add.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
[pCrossTabObject]
If graphDataType=crCrossTabGraph, this parameter specifies the CrossTabObject to associate with the chart.
Returns

Returns a GraphObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddLineObject Method (Section Object)

The AddLineObject method adds a LineObject Object to the Section Object. If optional parameter [pEndSection] is passed different from the current section, you can add a vertical line across sections.

Syntax

Function AddLineObject (Left As Long, Top As Long,

    Right As Long, Bottom As Long, [pEndSection]) As LineObject

Parameters

Parameter
Description
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Right
Specifies the offset of the bottom right corner of theObject that you are adding relative to the bottom right corner of the parent (or end) Section, in twips.
Bottom
Specifies the offset of the bottom right corner of theObject that you are adding relative to the bottom right corner of the parent (or end) Section, in twips.
[pEndSection]
Specifies the Section in which the end of the LineObject will be placed, if not the parent Section.
Returns

Returns a LineObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddPictureObject Method (Section Object)

The AddLineObject method adds a picture object from an image in the form of an OleObject Object to the Section Object.

Syntax

Function AddPictureObject (pImageFilePath As String, Left As Long,

    Top As Long) As OleObject

Parameters

Parameter
Description
pImageFilePath
Specifies the image file path and name that you want to add.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Returns

Returns a OleObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddSpecialVarFieldObject Method (Section Object)

The SpecialVarFieldObject Method adds a SpecialVar FieldObject Object to the Section Object.

Syntax

Function AddSpecialVarFieldObject (specialVarType As CRSpecialVarType,

    Left As Long, Top As Long) As FieldObject

Parameters

Parameter
Description
specialVarType
CRSpecialVarType
. Specifies the SpecialVar type.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Returns

Returns a FieldObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddSubreportObject Method (Section Object)

The SubReportObject method adds a SubreportObject Object to the Section Object. This method adds an empty subreport to the Section. You can then add Objects and Sections to the SubreportObject.

Syntax

Function AddSubreportObject (pSubreportName As String,

    Left As Long, Top As Long) As SubreportObject

Parameters

Parameter
Description
pSubreportName
Specifies the name of the subreport that you want to add.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Returns

Returns a SubreportObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddSummaryFieldObject Method (Section Object)

The AddSummaryField method adds a summary FieldObject Object to the Section Object.

Syntax

Function AddSummaryFieldObject (Field, SummaryType As CRSummaryType,

    Left As Long, Top As Long, [secondSummaryFieldOrFactor]) As FieldObject

Parameters

Parameter
Description
Field
Specifies the summary field that you want to add.
SummaryType
CRSummaryType
. Specifies the type of summary field.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
[secondSummary
FieldOrFactor]
Specifies the second summary field or factor, if required by the summary type.
Returns

Returns a FieldObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddTextObject Method (Section Object)

The AddTextObject method adds a TextObject Object to the Section Object. String parameter pText can contain formatting information such as tab stops and carriage returns.

Syntax

Function AddTextObject (pText As String,  Left As Long, Top As Long, [formatText]) As TextObject

Parameters

Parameter
Description
pText
Specifies the text that you want to add.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
[formatText]
Boolean. If TRUE, the text will be formatted according to the formatting characters included in the text string (for example, carriage returns, tabs, etc.). If FALSE, formatting characters in the text string will be ignored.
Returns

Returns a FieldObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddUnboundFieldObject Method (Section Object)

The AddUnboundFieldObject method adds an unbound FieldObject Object to the Section Object. The unbound field can be bound to a Crystal Report formula or a data source at runtime.

Syntax

Function AddUnboundFieldObject (ValueType As CRFieldValueType,

    Left As Long, Top As Long) As FieldObject

Parameters

Parameter
Description
ValueType
CRFieldValueType
. Specifies the type of value in the field.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Returns

Returns a FieldObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DeleteObject Method (Section Object)

The DeleteObject method removes an object from the Section Object

Syntax

Sub DeleteObject (reportObject)

Parameter

Parameter
Description
reportObject
Specifies the report object that you want to remove from the Section.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ImportSubreport Method (Section Object)

The ImportSubreport method imports a SubreportObject Object into the Section Object. With this call you can insert a subreport object obtained from an existing report file. The inserted Subreport Object will have all of the Objects and Sections of the original (source) report, except for Page Header and Page Footer Sections.

Syntax

Function ImportSubreport (subreportFileName As String,

    Left As Long, Top As Long) As SubreportObject

Parameters

Parameter
Description
subreportFileName
Specifies the name of the subreport that you want to import.
Left
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Top
Specifies the offset of the top left corner of the Object that you are adding relative to the top left corner of the parent Section, in twips.
Returns

Returns a SubreportObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Section Object Events

The following events are discussed in this section:

Format Event (Section Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Format Event (Section Object)

The Format event is fired before the print engine starts formatting a section. In the Format event handler you can use the object model to write some code to change the outcome of the formatted section. Be aware, however, that not all of the properties and methods provided in the object model are accessible at all times in the event handler. Specifically, only those properties and methods that have been marked "formatting active" or "no restrictions" can be used in the Event.

Syntax

Event Format (FormattingInfo As Object)

Parameter

Parameter
Description
FormattingInfo
The FormattingInfo object which will contain formatting information to be used by the Format event handler.
Remarks

The following comments regarding Restrictions and Rules apply to Format Event:

Restrictions

The Format event handler should not have any state. No matter when or how many times it is called it should always behave the same way. It should not keep track of how many times it is called and then, for example, change the background color based on how many times it has been called. The print engine formatting procedure is very complicated and one section can be formatted many times depending on different situations.

Note: Because the Format event for each section may be fired more than once during page printing you should not use it to do any totaling in which values are carried over from one section to another. However, you can use report variables to do calculated fields.

There are three formatting modes:

FormattingIdle
No formatting occurs. This can be before going to preview or print or between changing pages in the viewer.
FormattingActive
The start of formatting an object. The object mode is marked as formatting active.
FormattingInactive
When the print engine is formatting and one object is in FormattingActive mode the rest of the objects are in FormattingInactive mode.

Since there is only one section Format event when one section is formatting all of the objects in that section are in FormattingActive mode and all the rest of the sections and objects are in FormattingInactive mode.

Rules

 	The read property can be accessed in any formatting mode. (There are a few exceptions, please see the object model reference section.)

 	Top level Report, Areas and Area write properties and methods can only be accessed in formatting idle mode, aside from a few exceptions.

 	When in FormattingIdle mode you should make changes before going to preview or print. Making changes between changing pages may result in an unexpected result.

 	For sections and objects within sections write property or method access is denied when the section is in FormattingInactive mode.

 	For sections and objects within sections some write property or method access is permitted and some denied while the section is in FormattingActive mode. Please refer the object model reference for details.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Sections Collection

Sections can come from either the Report Object or Area Object. The Sections Collection is a collection of section objects. Access a specific Section Object in the collection using the Item property.

 	When from the Report Object, the sections object will contain all the sections in the report.

 	When from the Area Object, the sections object will contain all the sections in the area only.

Sections Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of section in the collection.
Read only
None
Item
(index)
Section Object
. Gets reference to an item in the Collection. Item has an index parameter that can be either a string reference to the area section (i.e., for areas with one section: "RH", "PH", "GHn", "D", "GFn", "PF", or "RF") or a numeric, 1-based index (i.e., Item (1)) for the Report Header area. Numeric index for sections starts at 1 for first section in the area/report and continues in order of appearance. If the area has multiple sections, they are represented using a lowercase letter (for example, "Da", "Db", etc.).
Read only
None
Parent
Report Object
 or
Area Object
. Gets reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a section directly, for example, Sections ("Da").

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Sections Collection Methods

The following methods are discussed in this section:

Add Method (Sections Collection)

Delete Method (Sections Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (Sections Collection)

Use Add method to add a Section Object to the Sections Collection.

Syntax

Function Add ([index]) As Section

Parameter

Parameter
Description
[index]
Specifies the index where you would like to add the Section to the Collection.
Returns

Returns a Section Object member of the Sections Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (Sections Collection)

Use Delete method to remove a Section Object from the Sections Collection.

Syntax

Sub Delete(index)

Parameter

Parameter
Description
index
Specifies the index of the Section that you want to delete from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SortField Object

The SortField Object includes properties for accessing information for record or group sort fields. It holds on to Report object, then releases the report object when destroyed. This object has an index instance variable to indicate its index.

SortField Object Properties

Property
Description
Read/Write
Restriction in event handler
Field
Object. Gets or sets the sorting field definition object.
Read/Write
Can be read or written only when formatting idle.
Parent
Report Object
. Gets reference to the parent object.
Read only
None
SortDirection
CRSortDirection
. Gets or sets  the sort direction.
Read/Write
Can be written only when formatting idle.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SortFields Collection

The SortFields Collection is a collection of sort fields; can be either record sort field or group sort field. Access a specific SortField Object in the collection using the Item property.

SortFields Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of sort fields in the collection.
Read only
None
Item
(index As
Long)
SortField Object
. Gets reference to an item in the Collection. Item has an index parameter that is a numeric, 1-based index (that is, Item (1)). The sort fields in the collection are indexed in the order they were added as sort fields to the report.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a sort field directly, for example, SortFields(1).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SortFields Collection Methods

The following methods are discussed in this section:

Add Method (SortFields Collection)

Delete Method (SortFields Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (SortFields Collection)

The Add method adds a record or group sort field to the Collection.

Syntax

Sub Add (pFieldDefinition As IFieldDefinition,

    SortDirection As CRSortDirection)

Parameters

Parameter
Description
pFieldDefinition
IFieldDefinition Object
. Specifies the field definition or field name.
SortDirection
CRSortDirection
. Specifies the direction in which the field data should be sorted (that is, ascending, descending, etc.).
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (SortFields Collection)

The Delete method deletes a record or group sort field from the Collection.

Syntax

Sub Delete (index As Long)

Parameter

Parameter
Description
index
Specifies the 1-based index number of the sort field in the collection that you want to delete.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SpecialVarFieldDefinition Object

The SpecialVarFieldDefinition Object provides properties for retrieving information and setting options for a special field found in your report (i.e., last modification date, print date, etc.). A SpecialVarFieldDefinition Object is obtained from the Field property of the FieldObject Object.

SpecialVarFieldDefinition Object Properties

Property
Description
Read/Write
Restriction in event handler
Kind
CRFieldKind
. Gets which kind of field (database, summary, formula, etc.).
Read only
None
Name
String. Gets the field definition unique formula name of the special var. field.
Read only
None
NextValue
Variant. Gets the field next value.
Read only
Can be read only when top-level Report object is formatting active.
NumberOfBytes
Integer. Gets the number of bytes required to store the field data in memory.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PreviousValue
Variant. Gets the field previous value.
Read only
Can be read only when top-level Report object is formatting active.
SpecialVarType
CRSpecialVarType
. Gets what the type of special field (for example, ReportTitle, PageNumber, etc.).
Read only
None
Value
Variant. Gets the field current value.
Read only
Can be read only when top-level Report object is formatting active.
ValueType
CRFieldValueType
. Gets which type of value is found in the field.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SQLExpressionFieldDefinition Object

The SQLExpressionFieldDefinition Object represents a SQL expression field used in the report. This object provides properties for getting information on SQL expression fields in the report.

SQLExpressionFieldDefinition Object Properties

Property
Definition
Read/Write
Restriction in event handler
Kind
CRFieldKind
. Gets which kind of field (that is, database, summary, formula, etc.).
Read only
None
Name
String. Gets the field definition unique formula name of the field within the report, Crystal formula syntax.
Read only
None
NextValue
Variant. Gets the field next value.
Read only
Can be read only when top-level Report object is formatting active.
NumberOfBytes
Integer. Gets the number of bytes required to store the field data in memory.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PreviousValue
Variant. Gets the field previous value.
Read only
Can be read only when top-level Report object is formatting active.
SQLExpression
FieldName
String. Gets the SQL expression field name.
Read only
None
Text
String. Gets or sets the SQL expression text.
Read/Write
Can be written only when formatting idle.
Value
Variant. Gets the field current value.
Read only
Can be read only when top-level Report object is formatting active.
ValueType
CRFieldValueType
. Gets which type of value is found in the field.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SQLExpressionFieldDefinition Object Methods

The following methods are discussed in this section:

Check Method (SQLExpressionFieldDefinition Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Check Method (SQLExpressionFieldDefinition Object)

Use Check method to check whether a SQL expression is valid.

Syntax

Sub Check (pBool As Boolean, ppErrorString As String)

Parameters

Parameter
Description
pBool
Boolean value indicating the condition of the formula string. Will be set to TRUE if the formula is valid and FALSE if the formula contains one or more errors.
ppErrorString
Specifies the error message string if the formula contains an error.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SQLExpressionFieldDefinitions Collection

The SQLExpressionFieldDefinitions Collection is a collection of SQL expression field definition objects. One object exists in the collection for every SQL expression field accessed by the report. Access a specific SQLExpressionFieldDefinition Object in the collection using the Item property.

SQLExpressionFieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of items in the Collection.
Read only
None
Item (index
As Long)
SQLExpressionFieldDefinition Object
. Gets an item from the Collection. Item has an index parameter that is a 1-based index (that is, Item (1) for the first SQL Expression field in the collection). The items in the collection are indexed in the order they were added to the report.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a database directly, for example, SQLExpressionFieldDefinitions(1).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SQLExpressionFieldDefinitions Collection Methods

The following methods are discussed in this section:

Add Method (SQLExpressionFieldDefinitions Collection)

Delete Method (SQLExpressionFieldDefinitions Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (SQLExpressionFieldDefinitions Collection)

Use Add method to add a SQLExpressionFieldDefinition Object to the Collection.

Syntax

Function Add (SQLExpressionName As String,

    Text As String) As SQLExpressionFieldDefinition

Parameters

Parameter
Description
SQLExpressionName
Specifies the name of the SQL expression that you want to add to the Collection.
Text
Specifies the text of the SQL expression that you want to add to the Collection.
Returns

Returns a SQLExpressionFieldDefinition Object member of the Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (SQLExpressionFieldDefinitions Collection)

Use Delete method to remove a SQLExpressionFieldDefinition Object from the Collection.

Syntax

Sub Delete (index)

Parameter

Parameter
Description
index
Specifies the index number of the SQLExpressionFieldDefinition Object that you want to remove from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SubreportLink Object

The SubreportLink Object provides information about Subreport Links to the main report.

SubreportLink Object Properties

Property
Description
Read/Write
Restriction in event handler
MainReportField
IFieldDefinition Object
. Gets the main report field to which the subreport field is linked.
Read only
None
Parent
SubreportObject Object
. Gets the subreport link’s parent object.
Read only
None
SubReportField
IFieldDefinition Object
. Gets the subreport field.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SubreportLinks Collection

The SubreportLinks Collection contains the SubreportLink Object related to the report.

SubreportLinks Collection Properties

Property
Description
Read/Write
Restriction in event handler
Count
Long. Gets a count of the items in the Collection.
Read only
None
Item (index
As Long)
SubreportLink Object
. Gets an item from the Collection.
Read only
None
Parent
SubreportObject Object
. Gets reference to the subreport link’s parent object.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SubreportLinks Collection Methods

The following methods are discussed in this section:

Add Method (SubreportLinks Collection)

Delete Method (SubreportLinks Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (SubreportLinks Collection)

Use Add method to add a SubreportLink Object to the Collection.

Syntax

Function Add (MainReportField, SubreportField) As SubreportLink

Parameters

Parameter
Description
MainReportField
Specifies the field in the main report that you want the new Object in the Collection to link.
SubreportField
Specifies the field in the subreport that you want the new Object in the Collection to link.
Returns

Returns a SubreportLink Object member of the Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (SubreportLinks Collection)

Use Delete method to remove a SubreportLink Object from the Collection.

Syntax

Sub Delete (index As Long)

Parameter

Parameter
Description
index
Specifies the index number of the Object in the Collection that you want to remove.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SubreportObject Object

The SubreportObject Object represents a subreport placed in a report. A subreport is a free-standing or linked report found within the main report. This object provides properties for retrieving information on the subreport (for example, name, formatting options, etc.).

SubreportObject Object Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomLineStyle
CRLineStyle
. Gets or sets the bottom line style.
Read/Write
Can be written only when formatting idle or active.
CanGrow
Boolean. Gets or sets the can grow option.
Read/Write
Can be written only when formatting idle or active.
CloseAtPage
Break
Boolean. Gets or sets close border on page break.
Read/Write
Can be written only when formatting idle or active.
EnableOn
Demand
Boolean. Gets the real-time subreport option.
Read only
None
HasDropShadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets the object height, in twips.
Read/Write
Can be written only when formatting idle or active.
KeepTogether
Boolean. Gets or sets the keep object together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets what kind of object (for example, box, cross-tab, field).
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
Links
SubreportLinks Collection
. Gets reference to the Collection.
Read Only
None
Name
String. Gets or sets the object name.
Read/Write
Can be written only when formatting idle or active.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
SubreportName
String. Gets or sets the name of the subreport.
Read/Write
Can be written only when formatting idle.
Suppress
Boolean. Gets or sets the object visibility option.
Read/Write
Can be written only when formatting idle or active.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets or sets the object width, in twips.
Read/Write
Can be written only when formatting idle or active.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SubreportObject Object Methods

The following methods are discussed in this section:

OpenSubreport Method (SubreportObject Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OpenSubreport Method (SubreportObject Object)

Every subreport has a pointer to its parent report. Subreports hold on to their parent reports until they are destroyed. The OpenSubreport method opens a subreport contained in the report and returns a Report Object corresponding to the named subreport. It corresponds to PEOpenSubreport of the Crystal Report Engine. This method can be invoked only in FormattingIdle or FormattingActive mode.

Syntax

Function OpenSubreport () As Report

Returns

Returns a SubreportObject Object.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ReImportSubreport Method (Subreport Object)

Subreports can be newly created in the main report or imported from an existing report file. If the subreport is imported from an existing report file, it can be re-imported at runtime using the ReImportSubreport method. When previewed, printed, or exported, a re-imported subreport will reflect all changes made to the formatting, grouping, and structure of the existing report file.

Syntax

Sub ReImportSubreport (pReimported as Boolean)

Parameter

Parameter
Description
pReimported
Boolean value indicating success or failure when re-importing the subreport. Will be set to TRUE if re-importing the subreport succeeds and FALSE if re-importing the subreport fails.See remarks below.
Remarks

pReimported is an output parameter. Create a variable to hold the result of pReimported and check the value of the variable to see if the method is successful.

Sample

'Boolean value to hold the result of the ReimportSubreport method

Dim bReimported As Boolean

'Call ReImportSubReport

Report.Subreport1.ReimportSubreport bReimported

'If bReimported is True the subreport re-imported successfully

'If bReimported is False the subreport failed to re-import

If bReimported Then

    MsgBox "Subreport re-imported successfully"

Else

    MsgBox "Subreport failed to re-import"

    Exit Sub

End If

'Refresh the viewer to display the updated subreport.

'Set the parameter to True if you want to update the data

'or False if you only want to refresh the report

CRViewer1.RefreshEx False

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SummaryFieldDefinition Object

The SummaryFieldDefinition Object represents the summary used in a cross-tab, group, or report.

SummaryFieldDefinition Object Properties

Property
Description
Read/Write
Restriction in event handler
FooterArea
Area Object
. Gets the area pair that the summary is in.
Read only
None
ForCrossTab
Boolean. Gets for-cross-tab.
Read only
None
HeaderArea
Area Object
. Gets the area pair that the summary is in.
Read only
None
Hierarchical
SummaryType
CRHierarchicalSummaryType
. Gets or sets wether or not to calculate the summary across the hierarchy in a hierarchically grouped report.
Read/Write
Can be written only when formatting idle.
Kind
CRFieldKind
. Gets which kind of field (database, summary, formula, etc.).
Read only
None
Name
String. Gets the field definition unique formula name of the summary field for a group or report summary field. Cross-tab summaries do not have a unique name so an empty string will be returned.
Read only
None
NextValue
Variant. Gets the field next value.
Read only
Can be read only when top-level Report object is formatting.
NumberOfBytes
Integer. Gets the number of bytes required to store the field data in memory.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
PreviousValue
Variant. Gets the field previous value.
Read only
Can be read only when top-level Report object is formatting.
Secondary
SummarizedField
Object. Gets the secondary summarized field.
Read only
None
SummarizedField
Object. Gets the summarized field.
Read only
None
SummaryOperationParameter
Long. Gets or sets the summary operation parameter.
Read/Write
Can be written only when formatting idle.
SummaryType
CRSummaryType
. Gets or sets the type of summary (for example, sum, average, etc.).
Read/Write
Can be written only when formatting idle.
Value
Variant. Gets the field current value.
Read only
Can be read only when top-level Report object is formatting active.
ValueType
CRFieldValueType
. Gets which type of value is found in the field.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SummaryFieldDefinition Object Methods

The following methods are discussed in this section:

SetSecondarySummarizedField Method (SummaryFieldDefinition Object)

SetSummarizedField Method (SummaryFieldDefinition Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetSecondarySummarizedField Method (SummaryFieldDefinition Object)

Use SetSecondarySummarizedField method to set the secondary summarized field for a report.

Syntax

Sub SetSecondarySummarizedField (secondarySummariedField)

Parameter

Parameter
Description
secondarySummariedField
Specifies the field that you want to set.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetSummarizedField Method (SummaryFieldDefinition Object)

Syntax

Sub SetSummarizedField (SummarizedField)

Parameter

Parameter
Description
SummarizedField
Specifies the field that you want to set.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SummaryFieldDefinitions Collection

The SummaryFieldDefinitions Collection is a collection of summary field definitions. Can be from either CrossTabObject Object or Report Object. Access a specific SummaryFieldDefinition Object in the collection using the Item property.

SummaryFieldDefinitions Collection Properties

Property
Description
Read/Write
Restriction in
event handler
Count
Long. Gets the number of summary fields in the collection.
Read only
None
Item
(index
As Long)
SummaryFieldDefinition Object
. Gets an item from the Collection. Item has an index parameter that is a numeric, 1-based index (for example, Item (1)). The items in the collection are indexed in the order they were added to the report.
Read only
None
Parent
Report Object
. Gets reference to the parent object.
Read only
None
Remarks

Instead of using the Item property as shown, you can reference a summary field directly, for example, SummaryFieldDefinitions(1).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SummaryFieldDefinitions Collection Methods

The following methods are discussed in this section:

Add Method (SummaryFieldDefinitions Collection)

Delete Method (SummaryFieldDefinitions Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (SummaryFieldDefinitions Collection)

Use Add method to add a SummaryFieldDefinition Object to the Collection.

Syntax

Function Add (groupLevel As Long, Field,

    SummaryType As CRSummaryType, [secondSummaryFieldOrFactor]

       As SummaryFieldDefinition

Parameters

Parameter
Description
groupLevel
Specifies the group level for the summary.
Field
Specifies the summary field.
SummaryType
CRSummaryType
. Specifies the summary type.
[secondSummaryFieldOr
Factor]
Specifies the second summary field or factor.
Returns

Returns a SummaryFieldDefinition Object member of the Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (SummaryFieldDefinitions Collection)

Use delete method to delete a SummaryFieldDefinition Object from the Collection.

Syntax

Sub Delete (index)

Parameter

Parameter
Description
index
Specifies the index number of the object that you want to delete from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


TableLink Object

The TableLink Object provides information about database table links.

TableLink Object Properties

Property
Description
Read/Write
Restriction in event handler
DestinationFields
DatabaseFieldDefinitions Collection
. Gets reference to table link destination field definitions Collection.
Read only
None
DestinationTable
DatabaseTable Object
. Gets reference to the table link destination table.
Read only
None
IndexUsed
Integer. Gets table link IndexUsed
Read only
None
JoinType
CRLinkJoinType
. Gets the table link join type.
Read only
None
LookupType
CRLinkLookUpType
. Gets table link lookup type.
Read only
None
Parent
Database Object
. Gets reference to the parent object.
Read only
None
PartialMatch Enabled
Boolean. Gets the table link partial-match enabled option.
Read only
None
SourceFields
DatabaseFieldDefinition Object
. Gets the table link source field definitions.
Read only
None
SourceTable
DatabaseTable Object
. Gets table link source table.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


TableLinks Collection

The TableLinks Collection contains the TableLink Object Objects associated with the report.

TableLinks Collection Properties

Property
Definition
Read/Write
Restriction in
event handler
Count
Long. Gets a count of the collection items.
Read only
None
Item (index As
Long)
TableLink Object
. Gets an item from the Collection.
Read only
None
Parent
Database Object
. Gets reference to the parent object.
Read only
None
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


TableLinks Collection Methods

The following methods are discussed in this section:

Add Method (TableLinks Collection)

Delete Method (TableLinks Collection)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Method (TableLinks Collection)

Use Add method to add a TableLink Object to the Collection.

Syntax

Function Add (psrcTable As DatabaseTable, pDestTable As DatabaseTable,

    srcFields, destFields,

    JoinType As CRLinkJoinType, LookupType As CRLinkLookUpType,

    PartialMatchEnabled As Boolean, indexInUse As Integer) As TableLink

Parameters

Parameter
Description
psrcTable
DatabaseTable Object
. Specifies the source database table.
pDestTable
DatabaseTable Object
. Specifies the destination database table.
srcFields
Specifies the source fields.
destFields
Specifies th destination fields.
JoinType
CRLinkJoinType
. Specifies the link join type.
LookupType
CRLinkLookUpType
. Specifies the link lookup type.
PartialMatchEnabled
Specifies whether the PartialMatchEnabled option has been set.
indexInUse
Specifies index in use.
Returns

Returns a TableLink Object member of the Collection.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Delete Method (TableLinks Collection)

Use Delete method to remove a TableLink Object from the Collection.

Syntax

Sub Delete (index As Long)

Parameter

Parameter
Description
index
Specifies the index number of the item that you want to remove from the Collection.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


TextObject Object

The Text Object represents a text object found in a report. This object provides properties for retrieving information and setting options for a text object in your report.

TextObject Object Properties

Property
Description
Read/Write
Restriction in event handler
BackColor
OLE_COLOR. Gets or sets the object background color.
Read/Write
Can be written only when formatting idle or active.
BorderColor
OLE_COLOR. Gets or sets the object border color.
Read/Write
Can be written only when formatting idle or active.
BottomLineStyle
CRLineStyle
. Gets or sets the bottom line style.
Read/Write
Can be written only when formatting idle or active.
CanGrow
Boolean. Gets or sets the can grow option.
Read/Write
Can be written only when formatting idle or active.
CharacterSpacing
Long. Gets or sets the character spacing.
Read/Write
Can be written only when formatting idle.
CloseAtPage
Break
Boolean. Gets or sets th close border on page break option.
Read/Write
Can be written only when formatting idle or active.
FirstLineIndent
Long. Gets or sets first line indent, in twips.
Read/Write
Can be written only when formatting idle.
Font
IFontDisp. Gets or sets the standard OLE font of the text object.
Read/Write
Can be written only when formatting idle or active.
HasDropShadow
Boolean. Gets or sets the border drop shadow option.
Read/Write
Can be written only when formatting idle or active.
Height
Long. Gets or sets the object height, in twips.
Read/Write
Can be written only when formatting idle or active.
HorAlignment
CRAlignment
. Gets or sets the horizontal alignment.
Read/Write
Can be written only when formatting idle.
KeepTogether
Boolean. Gets or sets the keep area together option.
Read/Write
Can be written only when formatting idle or active.
Kind
CRObjectKind
. Gets what kind of object (for example, box, cross-tab, field).
Read only
None
Left
Long. Gets or sets the object upper left position, in twips.
Read/Write
Can be written only when formatting idle or active.
LeftIndent
Long. Gets or sets left indent.
Read/Write
Can be written only when formatting idle.
LeftLineStyle
CRLineStyle
. Gets or sets the left line style.
Read/Write
Can be written only when formatting idle or active.
LineSpacing
Double. Gets the line spacing.
Read only
Can be written only when formattin idle.
LineSpacingType
CRLineSpacingType
. Gets the line spacing type.
Read only
MaxNumberOf
Lines
Integer. Gets or sets the maximum number of line for a string memo field.
Read/Write
Can be written only when formatting idle or active.
Name
String. Gets or sets area name.
Read/Write
Can be written only when formatting idle.
Parent
Section Object
. Gets reference to the parent object.
Read only
None
RightIndent
Long. Gets or sets the right indent.
Read/Write
Can be written only when formatting idle.
RightLineStyle
CRLineStyle
. Gets or sets the right line style.
Read/Write
Can be written only when formatting idle or active.
Suppress
Boolean. Gets or sets object visibility.
Read/Write
Can be written only when formatting idle or active.
SuppressIf
Duplicated
Boolean. Gets or sets the suppress if duplicated option.
Read/Write
Can be written only when formatting idle or active.
Text
String. Gets the text within the text object. If it has embedded fields, [] is used to represent the embedded field.
Read only
None
TextColor
OLE_COLOR. Gets or sets the object text color.
Read/Write
Can be written only when formatting idle.
TextRotation
Angle
CRRotationAngle
. Gets or sets text rotation angle.
Read/Write
Can be written only when formatting idle.
Top
Long. Gets or sets the object upper top position, in twips.
Read/Write
Can be written only when formatting idle or active.
TopLineStyle
CRLineStyle
. Gets or sets the top line style.
Read/Write
Can be written only when formatting idle or active.
Width
Long. Gets or sets the object width, in twips.
Read/Write
Can be written only when formatting idle or active.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


TextObject Object Methods

The following methods are discussed in this section:

SetLineSpacing Method (TextObject Object)

SetLineSpacing Method (TextObject Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetLineSpacing Method (TextObject Object)

Use the SetLineSpacing method to set the line spacing for a TextObject Object. The information passed will be used during formatting.

Syntax

Sub SetLineSpacing (LineSpacing As Double,

    LineSpacingType As CRLineSpacingType)

Parameters

Parameter
Description
LineSpacing
Specifies the line spacing.
LineSpacingType
CRLineSpacingType
. Specifies the line spacing type.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetText Method (TextObject Object)

Use the SetText method to set the text object to return the specified text. This method can be invoked only in the FormattingIdle or FormattingActive mode.

Syntax

Sub SetText (pText As String)

Parameter

Parameter
Description
pText
Specifies the text string for the Object. See Remarks below.
Remarks

When the SetText method is called within the sections Format event handler, the text parameter passed should not be dependent upon some state that the event handler may be tracking. For example, the event handler may hold a count and increment it each time the Format event is fired. This could should not be used directly or indirectly to create the SetText text parameter.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Enumerated Types

CRAlignment

Constant
Value
crDefaultAlign
0
crHorCenterAlign
2
crJustified
4
crLeftAlign
1
crRightAlign
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRAMPMType

Constant
Value
crAmPmAfter
1
crAmPmBefore
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRAreaKind

Constant
Value
crDetail
4
crGroupFooter
5
crGroupHeader
3
crPageFooter
7
crPageHeader
2
crReportFooter
8
crReportHeader
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRBarSize

Constant (numeric order)
Description
crMinimumBarSize
0
crSmallBarSize
1
crAverageBarSize
2
crLargeBarSize
3
crMaximumBarSize
4
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRBindingMatchType

Constant
Value
crBMTName
0
crBMTNameAndValue
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRBooleanOutputType

Constant
Value
crOneOrZero
4
crTOrF
1
crTrueOrFalse
0
crYesOrNo
2
crYOrN
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRConvertDateTimeType

Constant
Value
crConvertDateTimeToDate
1
crConvertDateTimeToString
0
crKeepDateTimeType
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRCurrencyPositionType

Constant
Value
crLeadingCurrencyInsideNegative
0
crLeadingCurrencyOutsideNegative
1
crTrailingCurrencyInsideNegative
2
crTrailingCurrencyOutsideNegative
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRCurrencySymbolType

Constant
Value
crCSTFixedSymbol
1
crCSTFloatingSymbol
2
crCSTNoSymbol
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDatabaseType

Constant
Value
crSQLDatabase
2
crStandardDatabase
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDateCalendarType

Constant
Value
crGregorianCalendar
1
crGregorianUSCalendar
2
crHijriCalendar
6
crJapaneseCalendar
3
crKoreanCalendar
5
crTaiwaneseCalendar
4
crThaiCalendar
7
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDateEraType

Constant
Value
crLongEra
1
crNoEra
2
crShortEra
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDateOrder

Constant
Value
crDayMonthYear
1
crMonthDayYear
2
crYearMonthDay
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDateWindowsDefaultType

Constant
Value
crNotUsingWindowsDefaults
2
crUseWindowsLongDate
0
crUseWindowsShortDate
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDayType

Constant
Value
crLeadingZeroNumericDay
1
crNoDay
2
crNumericDay
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDiscreteOrRangeKind

Constant (numeric order)
Value
crDiscreteValue
0
crRangeValue
1
crDiscreteAndRangeValue
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDivisionMethod

Constant
Value
crAutomaticDivision
0
crManualDivision
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRExchangeDestinationType

Constant
Value
crExchangeFolderType
0
crExchangePostDocMessage
1011
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRExportDestinationType

Constant
Value
crEDTApplication
5
crEDTDiskFile
1
crEDTEMailMAPI
2
crEDTEMailVIM
3
crEDTLotusDomino
6
crEDTMicrosoftExchange
4
crEDTNoDestination
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRExportFormatType

Constant
Value
crEFTCharSeparatedValues
7
crEFTCommaSeparatedValues
5
crEFTCrystalReport
1
crEFTCrystalReport70
33
crEFTDataInterchange
2
crEFTExactRichText
35
crEFTExcel50
21
crEFTExcel50Tabular
22
crEFTExcel70
27
crEFTExcel70Tabular
28
crEFTExcel80
29
crEFTExcel80Tabular
30
crEFTExplorer32Extend
25
crEFTHTML32Standard
24
crEFTHTML40
32
crEFTLotus123WK1
12
crEFTLotus123WK3
13
crEFTLotus123WKS
11
crEFTNoFormat
0
crEFTODBC
23
crEFTPaginatedText
10
crEFTPortableDocFormat
31
crEFTRecordStyle
3
crEFTReportDefinition
34
crEFTTabSeparatedText
9
crEFTTabSeparatedValues
6
crEFTText
8
crEFTWordForWindows
14
crEFTXML
36
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRFieldKind

Constant
Value
crDatabaseField
1
crFormulaField
2
crGroupNameField
5
crRunningTotalField
7
crParameterField
6
crSpecialVarField
4
crSQLExpressionField
8
crSummaryField
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRFieldMappingType

Constant
Value
crAutoFieldMapping
0
crEventFieldMapping
2
crPromptFieldMapping
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRFieldValueType

Constant
Value
crBitmapField
17
crBlobField
15
crBooleanField
9
crChartField
21
crCurrencyField
8
crDateField
10
crDateTimeField
16
crIconField
18
crInt16sField
3
crInt16uField
4
crInt32sField
5
crInt32uField
6
crInt8sField
1
crInt8uField
2
crNumberField
7
crOleField
20
crPersistentMemoField
14
crPictureField
19
crStringField
12
crTimeField
11
crTransientMemoField
13
crUnknownField
22
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRFormulaSyntax

Constant
Value
crBasicSyntaxFormula
1
crCrystalSyntaxFormula
0 Default value
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRGraphColor

Constant
Value
crBlackAndWhiteGraph
1
crColorGraph
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRGraphDataPoint

Constant
Value
crNone
0
crShowLabel
1
crShowValue
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRGraphDataType

Constant
Value
crCrossTabGraph
2
crDetailGraph
1
crGroupGraph
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRGraphDirection

Constant
Value
crHorizontalGraph
0
crVerticalGraph
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRGraphType

Constant
Value
crAbsoluteAreaGraph
20
crDualAxisBubbleGraph
91
crFaked3DAbsoluteAreaGraph
23
crFaked3DPercentAreaGraph
25
crFaked3DPercentBarGraph
5
crFaked3DRegularPieGraph
31
crFaked3DSideBySideBarGraph
3
crFaked3DStackedAreaGraph
24
crFaked3DStackedBarGraph
4
crHighLowDualAxisGraph
101 Obsolete.
crHighLowGraph
100
crHighLowOpenCloseDualAxisGraph
105 Obsolete.
crHighLowOpenCloseGraph
104
crHighLowOpenDualAxisGraph
103 Obsolete.
crHighLowOpenGraph
102 Obsolete.
crLineGraphWithMarkers
13
crMultipleDoughnutGraph
41
crMultiplePieGraph
32
crMultipleProportionalDoughnut
Graph
42
crMultipleProportionalPieGraph
33
crPercentageLineGraph
12
crPercentageLineGraphWithMarkers
15
crPercentAreaGraph
22
crPercentBarGraph
2
crRadarDualAxisGraph
82
crRegularBubbleGraph
90
crRegularDoughnutGraph
40
crRegularLineGraph
10
crRegularPieGraph
30
crRegularRadarGraph
80
crSideBySideBarGraph
0
crStackedAreaGraph
21
crStackedBarGraph
1
crStackedLineGraph
11
crStackedLineGraphWithMarkers
14
crStackedRadarGraph
81
crThreeDCutCornersGraph
53
crThreeDOctagonGraph
52
crThreeDPyramidGraph
51
crThreeDRegularGraph
50
crThreeDSurfaceHoneycombGraph
62
crThreeDSurfaceRegularGraph
60
crThreeDSurfaceWithSidesGraph
61
crUnknownGraph
1000
crXyScatterDualAxisGraph
71
crXyScatterDualAxisWithLabelsGraph
73
crXyScatterGraph
70
crXyScatterWithLabelsGraph
72
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRGridlineType

Constant
Value
crMajorAndMinorGridlines
3
crMajorGridlines
2
crMinorGridlines
1
crNoGridlines
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRGroupCondition

Constant
Value
crGCAnnually
7
crGCAnyValue
14
crGCBiweekly
2
crGCByAMPM
18
crGCByHour
17
crGCByMinute
16
crGCBySecond
15
crGCDaily
0
crGCEveryNo
11
crGCEveryYes
10
crGCMonthly
4
crGCNextIsNo
13
crGCNextIsYes
12
crGCQuarterly
5
crGCSemiAnnually
6
crGCSemimonthly
3
crGCToNo
9
crGCToNo
8
crGCWeekly
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRHierarchicalSummaryType

Constant
Value
crHierarchicalSummaryNone
0
crSummaryAcrossHierarchy
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRHourType

Constant
Value
Const crNoHour
2
Const crNumericHour
0
Const
crNumericHourNoLeadingZero
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRHTMLPageStyle

Constant
Value
crFramePageStyle
2
crPlainPageStyle
0
crToolbarAtBottomPageStyle
4
crToolbarAtTopPageStyle
3
crToolbarPageStyle
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRHTMLToolbarStyle

These bitwise constants can be XOR’d to specify the toolbar style.

Constant
Value
crToolbarRefreshButton
1
crToolbarSearchBox
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRImageType

Constant
Value
crDIBImageType
1
crJPEGImageType
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRLeadingDayPosition

Constant
Value
crLeadingDayOfWeek
0
crTrailingDayOfWeek
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRLeadingDayType

Constant
Value
crLongLeadingDay
1
crNoLeadingDay
2
crShortLeadingDay
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRLegendPosition

Constant
Value
crPlaceBottomCenter
1
crPlaceLeft
4
crPlaceRight
3
crPlaceTopCenter
2
crPlaceUpperRight
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRLineSpacingType

Constant
Value
crExactSpacing
1
crMultipleSpacing
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRLineStyle

Constant
Value
crLSDashLine
3
crLSDotLine
4
crLSDoubleLine
2. Not valid for LineObject.LineStyle and BoxObject.LineStyle.
crLSNoLine
0. Not valid for LineObject.LineStyle and BoxObject.LineStyle.
crLSSingleLine
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRLinkJoinType

Constant
Value
crJTEqual
4
crJTGreaterOrEqual
10
crJTGreaterThan
8
crJTLeftOuter
5
crJTLessOrEqual
11
crJTLessThan
9
crJTNotEqual
12
crJTRightOuter
6
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRLinkLookUpType

Constant
Value
crLTLookupParallel
1
crLTLookupProduct
2
crLTLookupSeries
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRMarkerShape

Constant
Value
crCircleShape
4
crDiamondShape
5
crRectangleShape
1
crTriangleShape
8
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRMarkerSize

Constant
Value
crLargeMarkers
4
crMediumLargeMarkers
3
crMediumMarkers
2
crMediumSmallMarkers
1
crSmallMarkers
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRMinuteType

Constant
Value
crNoMinute
2
crNumericMinute
0
crNumericMinuteNoLeadingZero
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRMonthType

Constant
Value
crLeadingZeroNumericMonth
1
crLongMonth
3
crNoMonth
4
crNumericMonth
0
crShortMonth
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRNegativeType

Constant
Value
crBracketed
3
crLeadingMinus
1
crNotNegative
0
crTrailingMinus
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRNumberFormat

Constant
Value
crCurrencyMillions
12
crCurrencyNoDecimal
3
crCurrencyThousands
11
crCurrencyTwoDecimal
4
crCustomNumberFormat
8
crMillionsNoDecimal
10
crNoDecimal
0
crOneDecimal
1
crPercentNoDecimal
5
crPercentOneDecimal
6
crPercentTwoDecimal
7
crThousandsNoDecimal
9
crTwoDecimal
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRObjectKind

Constant
Value
crBlobFieldObject
9
crBoxObject
4
crCrossTabObject
8
crFieldObject
1
crGraphObject
7
crLineObject
3
crMapObject
10
crOlapGridObject
11
crOleObject
6
crSubreportObject
5
crTextObject
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPaperOrientation

Constant
Value
crDefaultPaperOrientation
0
crLandscape
2
crPortrait
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPaperSize

Constant
Value
crDefaultPaperSize
0
crPaper10x14
16
crPaper11x17
17
crPaperA3
8
crPaperA4
9
crPaperA4Small
10
crPaperA5
11
crPaperB4
12
crPaperB5
13
crPaperCsheet
24
crPaperDsheet
25
crPaperEnvelope10
20
crPaperEnvelope11
21
crPaperEnvelope12
22
crPaperEnvelope14
23
crPaperEnvelope9
19
crPaperEnvelopeB4
33
crPaperEnvelopeB5
34
crPaperEnvelopeB6
35
crPaperEnvelopeC3
29
crPaperEnvelopeC4
30
crPaperEnvelopeC5
28
crPaperEnvelopeC6
31
crPaperEnvelopeC65
32
crPaperEnvelopeDL
27
crPaperEnvelopeItaly
36
crPaperEnvelopeMonarch
37
crPaperEnvelopePersonal
38
crPaperEsheet
26
crPaperExecutive
7
crPaperFanfoldLegalGerman
41
crPaperFanfoldStdGerman
40
crPaperFanfoldUS
39
crPaperFolio
14
crPaperLedger
4
crPaperLegal
5
crPaperLetter
1
crPaperLetterSmall
2
crPaperNote
18
crPaperQuarto
15
crPaperStatement
6
crPaperTabloid
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPaperSource

Constant
Value
crPRBinAuto
7
crPRBinCassette
14
crPRBinEnvelope
5
crPRBinEnvManual
6
crPRBinFormSource
15
crPRBinLargeCapacity
11
crPRBinLargeFmt
10
crPRBinLower
2
crPRBinManual
4
crPRBinMiddle
3
crPRBinSmallFmt
9
crPRBinTractor
8
crPRBinUpper
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRParameterFieldType

Constant
Value
crQueryParameter
1
crReportParameter
0
crStoreProcedureParameter
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRParameterPickListSortMethod

Constant (numeric order)
Value
crNoSort
0
crAlphanumericAscending
1
crAlphanumericDescending
2
crNumericAscending
3
crNumericDescending
4
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPieLegendLayout

Constant
Value
crAmountLayout
1
crCustomLayout
2
crPercentLayout
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPieSize

Constant (numeric order)
Value
crMaximumPieSize
0
crLargePieSize
16
crAveragePieSize
32
crSmallPieSize
48
crMinimumPieSize
64
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPlaceHolderType

Constant
Value
crAllowPlaceHolders
2
crDelayTotalPageCountCalc
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPrinterDuplexType

Constant
Value
crPRDPDefault
0
crPRDPHorizontal
3
crPRDPSimplex
1
crPRDPVertical
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRPrintingProgress

Constant
Value
crPrintingCancelled
5
crPrintingCompleted
3
crPrintingFailed
4
crPrintingHalted
6
crPrintingInProgress
2
crPrintingNotStarted
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRRangeInfo

Constant (numeric order)
Value
crRangeNotIncludeUpperLowerBound
0
crRangeIncludeUpperBound
1
crRangeIncludeLowerBound
2
crRangeNoUpperBound
4
crRangeNoLowerBound
8
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRRenderResultType

Constant
Value
crBSTRType
8. This constant is currently not supported.
crUISafeArrayType
8209
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRReportFileFormat

Constant
Value
cr70FileFormat
1792
cr80FileFormat
2048
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRReportKind

Constant
Value
crColumnarReport
1
crLabelReport
2
crMulColumnReport
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRReportVariableValueType

Constant
Value
crRVBoolean
2
crRVCurrency
1
crRVDate
3
crRVDateTime
5
crRVNumber
0
crRVString
6
crRVTime
4
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRRotationAngle

Constant (numeric order)
Value
crRotate0
0
crRotate90
1
crRotate270
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRRoundingType

Constant (numeric order)
Value
crRoundToMillion
17
crRoundToHundredThousand
16
crRoundToTenThousand
15
crRoundToThousand
14
crRoundToHundred
13
crRoundToTen
12
crRoundToUnit
11
crRoundToTenth
10
crRoundToHundredth
9
crRoundToThousandth
8
crRoundToTenThousandth
7
crRoundToHundredThousandth
6
crRoundToMillionth
5
crRoundToTenMillionth
4
crRoundToHundredMillionth
3
crRoundToBillionth
2
crRoundToTenBillionth
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRRunningTotalCondition

Constant
Value
crRTEvalNoCondition
0
crRTEvalOnChangeOfField
1
crRTEvalOnChangeOfGroup
2
crRTEvalOnFormula
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRSearchDirection

Constant (numeric order)
Value
crForward
0
crBackward
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRSecondType

Constant
Value
crNumericNoSecond
2
crNumericSecond
0
crNumericSecondNoLeadingZero
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRSliceDetachment

Constant (numeric order)
Value
crLargestSlice
2
crSmallestSlice
1
crNoDetachment
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRSortDirection

Constant
Value
crAscendingOrder
0
crDescendingOrder
1
crOriginalOrder
2. Not supported for any kind of groups.
crSpecifiedOrder
3. Not supported for any kind of groups.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRSpecialVarType

Constant
Value
crSVTDataDate
4
crSVTDataTime
5
crSVTFileAuthor
15
crSVTFileCreationDate
16 (&H10)
crSVTFilename
14
crSVTGroupNumber
8
crSVTGroupSelection
13
crSVTModificationDate
2
crSVTModificationTime
3
crSVTPageNofM
17 (&H11)
crSVTPageNumber
7
crSVTPrintDate
0
crSVTPrintTime
1
crSVTRecordNumber
6
crSVTRecordSelection
12
crSVTReportComments
11
crSVTReportTitle
10
crSVTTotalPageCount
9
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRSummaryType

Constant
Value
crSTAverage
1
crSTCount
6
crSTDCorrelation
10
crSTDCovariance
11
crSTDistinctCount
9
crSTDMedian
13
crSTDMode
17
crSTDNthLargest
15
crSTDNthMostFrequent
18
crSTDNthSmallest
16
crSTDPercentage
19
crSTDPercentile
14
crSTDWeightedAvg
12
crSTMaximum
4
crSTMinimum
5
crSTPopStandardDeviation
8
crSTPopVariance
7
crSTSampleStandardDeviation
3
crSTSampleVariance
2
crSTSum
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRTableDifferences

Constant
Value
crTDOK
0x00000000
crTDDatabaseNotFound
0x00000001
crTDServerNotFound
0x00000002
crTDServerNotOpened
0x00000004
crTDAliasChanged
0x00000008
crTDIndexesChanged
0x00000010
crTDDriverChanged
0x00000020
crTDDictionaryChanged
0x00000040
crTDFileTypeChanged
0x00000080
crTDRecordSizeChanged
0x00000100
crTDAccessChanged
0x00000200
crTDParametersChanged
0x00000400
crTDLocationChanged
0x00000800
crTDDatabaseOtherChanges
0x00001000
crTDNumberFieldChanged
0x00010000
crTDFieldOtherChanges
0x00020000
crTDFieldNameChanged
0x00040000
crTDFieldDescChanged
0x00080000
crTDFieldTypeChanged
0x00100000
crTDFieldSizeChanged
0x00200000
crTDNativeFieldTypeChanged
0x00400000
crTDNativeFieldOffsetChanged
0x00800000
crTDNativeFieldSizeChanged
0x01000000
crTDFieldDecimalPlacesChanged
0x02000000
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRTextFormat

Constant
Value
crHTMLText
2
crRTFText
1
crStandardText
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRTimeBase

Constant
Value
cr12Hour
0
cr24Hour
1
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRTopOrBottomNGroupSortOrder

Constant
Value
crAllGroupsSorted
1
crAllGroupsUnsorted
0
crBottomNGroups
3
crTopNGroups
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRValueFormatType

Constant
Value
crAllowComplexFieldFormatting
4
crIncludeFieldValues
1
crIncludeHiddenFields
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRViewingAngle

Constant
Value
crBirdsEyeView
15
crDistortedStdView
10
crDistortedView
4
crFewGroupsView
9
crFewSeriesView
8
crGroupEmphasisView
7
crGroupEyeView
6
crMaxView
16
crShorterView
12
crShortView
5
crStandardView
1
crTallView
2
crThickGroupsView
11
crThickSeriesView
13
crThickStdView
14
crTopView
3
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRYearType

Constant
Value
crLongYear
1
crNoYear
2
crShortYear
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Viewer Object Model

The Crystal Report Viewer contains an extensive object model allowing you complete control over how the viewer appears and functions. This section provides detailed information on the properties, methods and events of the Crystal Report Viewer object model for both the ActiveX viewer, and the Java Bean viewer.

Click the appropriate link to jump to that section:

 	Report Viewer/ActiveX Object Model Technical Reference

 	Enumerated Types - Report Viewer

 	The Report Viewer/Java Bean Technical Reference

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Report Viewer/ActiveX Object Model Technical Reference

The following diagram outlines the Report Viewer hierarchy.

CRField Object (CRVIEWERLib)

The CRField Object contains information related to the fields in a report displayed in the Report Viewer.

CRField Object Properties

Property
Description
Read/Write
FieldType
CRFieldType (CRViewerLib)
. Gets the type of field.
Read-only
IsRawData
Boolean. Gets whether or not the data in the field is raw data.
Read-only
Name
String. Gets the name of the field.
Read-only
Value
Variant. Default property gets the value in the field.
Read-only
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRFields Collection (CRVIEWERLib)

The CRFields Collection contains instances of CRFields Objects.

CRFields Collection Properties

Property
Description
Read/Write
Count
Long. Gets the total number of items in the Collection.
Read-only
Item (index As Long)
Long. Default property gets the 1-based index number of the item in the Collection.
Read-only
SelectedFieldIndex
Long. Gets the index of the selected field.
Read-only
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRVEventInfo Object (CRVIEWERLib)

The CRVEventInfo Object contains information about events relating to objects within a report.

CRVEventInfo Object Properties

Property
Description
Read/Write
CanDrillDown
Boolean. Gets whether or not the object is drillable.
Read-only
Index
Long. Gets or sets the number identifying a control in a control array.
Read-only
ParentIndex
Long. Gets reference to the object’s parent’s index.
Read-only
Text
String. Gets the object’s text string.
Read-only
Type
CRObjectType (CRViewerLib)
. Gets the object type.
Read-only
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRVEventInfo Object Methods

The following methods are discussed in this section:

GetFields Method (CRVEventInfo Object)

GetFields Method (CRVEventInfo Object)

Use GetFields method to get the Fields Collection.

Syntax

Function GetFields ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRViewer Object (CRVIEWERLib)

The CRViewer Object is the primary object representing the Report Viewer control as it appears on a Form in your Visual Basic application. The current interface is ICrystalReportViewer3.

CRViewer Object Methods

CRViewer Object Events

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRViewer Object Properties

Property
Description
Read/Write
ActiveViewIndex
Integer. Gets the 1-based index of the current view (tab).
Read only
DisplayBackgroundEdge
Boolean. Gets or sets whether the report is offset from the edge of its view window.
Read/Write
DisplayBorder
Boolean. Gets or sets whether the border of the viewer object is displayed.
Read/Write
DisplayGroupTree
Boolean. Gets or sets the visibility of the group tree.
Read/Write
DisplayTabs
Boolean. Gets or sets whether the viewer has tabs for navigation between views.
Read/Write
DisplayToolbar
Boolean. Gets or sets the visibility of the toolbar.
Read/Write
EnableAnimationCtrl
Boolean. Gets or sets whether or not the animation control is visible.
Read/Write
EnableCloseButton
Boolean. Gets or sets the visibility of the close button.
Read/Write
EnableDrillDown
Boolean. Gets or sets whether drill down is allowed.
Read/Write
EnableExportButton
Boolean. Gets or sets the visibility of the Export toolbar button.
Read/Write
EnableGroupTree
Boolean. Gets or sets whether or not the group tree is available.
Read/Write
EnableHelpButton
Boolean. Gets or sets whether or not the help button appears on the toolbar.
Read/Write
EnableNavigationControls
Boolean. Gets or sets whether or not the First Page button, Previous Page button, Next Page button, and Last Page button appear on the toolbar.
Read/Write
EnablePopupMenu
Boolean. Gets or sets whether the popup menu is available.
Read/Write
EnablePrintButton
Boolean. Gets or sets the visibility of the Print button.
Read/Write
EnableProgressControl
Boolean. Gets or sets the visibility of the progress control.
Read/Write
EnableRefreshButton
Boolean. Gets or sets the visibility of the Refresh button.
Read/Write
EnableSearchControl
Boolean. Gets or sets the visibility of the search control.
Read/Write
EnableSearchExpertButton
Boolean. Gets or sets the status of the Search Expert toolbar button.
Read/Write
EnableStopButton
Boolean. Gets or sets whether the viewer displays the stop button.
Read/Write
EnableToolbar
Boolean. Gets or sets the visibility of the toolbar.
Read/Write
EnableZoomControl
Boolean. Gets or sets the visibility of the zoom control.
Read/Write
IsBusy
Boolean. Gets the status of the control, busy or not busy.
Read only
ReportSource
Unknown. Gets or sets the report source.
Read/Write
TrackCursorInfo
CRVTrackCursorInfo Object (CRVIEWERLib)
. Gets reference to TrackCursor information.
Read only
ViewCount
Integer. Gets the current number of views (tabs).
Read only
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRViewer Object Methods

The following methods are discussed in this section:

ActivateView Method (CRViewer Object)

AddView Method (CRViewer Object)

CloseView Method (CRViewer Object)

GetCurrentPageNumber Method (CRViewer Object)

GetViewName Method (CRViewer Object)

GetViewPath Method (CRViewer Object)

PrintReport Method (CRViewer Object)

Refresh Method (CRViewer Object)

SearchByFormula Method (CRViewer Object)

SearchForText Method (CRViewer Object)

ShowFirstPage Method (CRViewer Object)

ShowGroup Method (CRViewer Object)

ShowLastPage Method (CRViewer Object)

ShowNextPage Method (CRViewer Object)

ShowNthPage Method (CRViewer Object)

ShowPreviousPage Method (CRViewer Object)

ViewReport Method (CRViewer Object)

Zoom Method (CRViewer Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRViewer Object Events

The following events are discussed in this section:

Clicked Event (CRViewer Object)

CloseButtonClicked Event (CRViewer Object)

DblClicked Event (CRViewer Object)

DownloadFinished Event (CRViewer Object)

DownloadStarted Event (CRViewer Object)

DrillOnDetail Event (CRViewer Object)

DrillOnGraph Event (CRViewer Object)

DrillOnGroup Event (CRViewer Object)

DrillOnSubreport Event (CRViewer Object)

ExportButtonClicked Event (CRViewer Object)

FirstPageButtonClicked Event (CRViewer Object)

GoToPageNClicked Event (CRViewer Object)

GroupTreeButtonClicked Event (CRViewer Object)

HelpButtonClicked Event (CRViewer Object)

LastPageButtonClicked Event (CRViewer Object)

NextPageButtonClicked Event (CRViewer Object)

OnReportSourceError Event (CRViewer Object)

PrevPageButtonClicked Event (CRViewer Object)

PrintButtonClicked Event (CRViewer Object)

RefreshButtonClicked Event (CRViewer Object)

SearchButtonClicked Event (CRViewer Object)

SearchExpertButtonClicked Event (CRViewer Object)

SelectionFormulaBuilt Event (CRViewer Object)

SelectionFormulaButtonClicked Event (CRViewer Object)

ShowGroup Event (CRViewer Object)

StopButtonClicked Event (CRViewer Object)

ViewChanged Event (CRViewer Object)

ViewChanging Event (CRViewer Object)

ZoomLevelChanged Event (CRViewer Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ActivateView Method (CRViewer Object)

Use ActivateView method to activate a particular view.

Syntax

Sub ActivateView ( Index )

Parameter

Parameter
Description
Index
The 1-based index number of the view that you want to activate.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddView Method (CRViewer Object)

Use AddView method to add a new view tab to the Viewer.

Syntax

Sub AddView ( GroupPath )

Parameter

Parameter
Description
GroupPath
GroupPath can be a colon-delimited string (Country:State:City) or a safe array of strings. It indicates the group for which you want to add a view (tab) to the Report Viewer window.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CloseView Method (CRViewer Object)

Use CloseView method to close the specified view.

Syntax

Sub CloseView ( Index )

Parameter

Parameter
Description
Index
The 1- based index number of the view that you want to close.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetCurrentPageNumber Method (CRViewer Object)

Use GetCurrentPageNumber method to retrieve the number of the page of the report that is currently being viewed.

Syntax

Function GetCurrentPageNumber () As Long

Returns

Returns the current page number, if the call is successful.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetViewName Method (CRViewer Object)

Use GetViewName method to retrieve the current view's tab name and the current report document's name.

Syntax

Function GetViewName ( pTabName As String ) As String

Parameter

Parameter
Description
pTabName
Specifies the name of the current view (tab) As String.
Returns

 	Returns the current report’s document name, if the call is successful.

 	Passes back the current view’s tab name.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetViewPath Method (CRViewer Object)

Use GetViewPath method to retrieve the path to the current view. Path contains a safe array of strings. Views refer to the main Preview Tab and drill down tabs that appear in the Report Viewer as the user interacts with the report.

Syntax

Function GetViewPath ( Index As Integer )

Parameter

Parameter
Description
Index
Specifies the 1-based index number of the view (tab) displayed in the Report Viewer for which you want to retrieve the path.
Returns

Returns a safe array of strings indicating the path to the current view, if the call is successful.

Example

Use the following code as an example of how to use GetViewPath.

Dim vPath As Variant

Dim vString As String

Dim x As Integer

Dim y As Integer

Dim counter As Integer

vPath = CRViewer1.GetViewPath(userEnteredInteger)

x = Lbound(vPath)

y = Ubound(vPath)

For counter = x To y

    If vString <> "" Then

       vString = vString & ":"

    End If

    vString = vString & vPath(counter)

Next counter

ViewPathName.Caption = "View path is: " & vString

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PrintReport Method (CRViewer Object)

Use PrintReport method to initiate printing of the report in the current view.

Syntax

Sub PrintReport ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Refresh Method (CRViewer Object)

Use Refresh method to reload and display the report displayed in the Report Viewer from its original source.

Syntax

Sub Refresh ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SearchByFormula Method (CRViewer Object)

Use SearchByFormula method to search using the specified formula. The Search GUI is displayed if parameter formula is empty.

Syntax

Sub SearchByFormula ( formula As String )

Parameter

Parameter
Description
formula
Specifies the formula that you want to use for the search As String.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SearchForText Method (CRViewer Object)

Use SearchForText to search for the specified String.

Syntax

Sub SearchForText ( Text As String )

Parameter

Parameter
Description
Text
Specifies the text that you want to search for As String.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ShowFirstPage Method (CRViewer Object)

Use ShowFirstPage method to display the first page of the report.

Syntax

Sub ShowFirstPage ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ShowGroup Method (CRViewer Object)

Use ShowGroup method to display the indicated group in the current view. GroupPath can be a colon-delimited string (Country:State:City) or a safe array of strings.

Syntax

Sub ShowGroup (GroupPath)

Parameter

Parameter
Description
GroupPath
Specifies the path to the group that you want to display. Use a safe array of strings or a colon delimited string (for example, Canada:BC:Vancouver).
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ShowLastPage Method (CRViewer Object)

Use ShowLastPage method to display the last page of the report.

Syntax

Sub ShowLastPage ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ShowNextPage Method (CRViewer Object)

Use ShowNextPage method to display the next page of the report.

Syntax

Sub ShowNextPage ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ShowNthPage Method (CRViewer Object)

Use ShowNthPage method to display the specified page of the report.

Syntax

Sub ShowNthPage ( PageNumber As Integer )

Parameter

Parameter
Description
PageNumber
The page number that you want to display As Integer.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ShowPreviousPage Method (CRViewer Object)

Use ShowPreviousPage method to display the previous page of the report.

Syntax

Sub ShowPreviousPage ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ViewReport Method (CRViewer Object)

Use ViewReport method to display the report.

Syntax

Sub ViewReport ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Zoom Method (CRViewer Object)

Use Zoom method to change the magnification used to display the report.

Syntax

Sub Zoom ( ZoomLevel As Integer )

Parameter

Parameter
Description
ZoomLevel
The zoom level to use to view the report As Integer. Indicate a percentage, or use 1 to fit the entire width of the page in the Report Viewer window (but not the entire page) or 2 to fit the entire page in the window.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Clicked Event (CRViewer Object)

The Clicked event occurs when an object in the viewer is clicked.

Syntax

Event Clicked ( x As Long, y As Long, EventInfo, UseDefault As Boolean )

Parameters

Parameter
Description
X
Long. The X coordinate of the object clicked.
Y
Long. The Y coordinate of the object clicked.
EventInfo
A
CRVEventInfo Object (CRVIEWERLib)
, containing information about the object clicked.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CloseButtonClicked Event (CRViewer Object)

The CloseButtonClicked event occurs when the Close Current View button is clicked.

Syntax

Event CloseButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DblClicked Event (CRViewer Object)

The DblClicked event occurs when an object is double clicked.

Syntax

Event DblClicked ( x As Long, y As Long, EventInfo, UseDefault As Boolean )

Parameters

Parameter
Description
X
Long. The X coordinate of the object that was double clicked.
Y
Long. The Y coordinate of the object that was double clicked.
EventInfo
A
CRVEventInfo Object (CRVIEWERLib)
, containing information about the object clicked.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DownloadFinished Event (CRViewer Object)

The DownloadFinished event occurs when report data finishes loading into the report. For example, if the user displays a new page, a new set of report data is downloaded.

Syntax

Event DownloadFinished ( loadingType As CRLoadingType )

Parameter

Parameter
Description
LoadingType
CRLoadingType (CRViewerLib)
. Indicates the type of data being loaded into the Report Viewer.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DownloadStarted Event (CRViewer Object)

The DownloadStarted event occurs when report data starts being downloaded into the Report Viewer. For example, if the user displays a new page, a new set of report data is downloaded.

Syntax

Event DownloadStarted ( loadingType As CRLoadingType )

Parameter

Parameter
Description
LoadingType
CRLoadingType (CRViewerLib)
. Indicates the type of data being loaded into the Report Viewer.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DrillOnDetail Event (CRViewer Object)

The DrillOnDetail event occurs when you drill down on a field in the Detail section of the report. This event is not available in the current version of the Report Viewer, but will be enabled in a future upgrade.

Syntax

Event DrillOnDetail ( FieldValues, SelectedFieldIndex As Long,

    UseDefault As Boolean )

Parameters

Parameter
Description
FieldValues
An array of objects containing details on the field.
SelectedFieldIndex
Long. The array index of the value in the field actually drilled on.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DrillOnGraph Event (CRViewer Object)

The DrillOnGraph event occurs when you drill down on a graph.

Syntax

Event DrillOnGraph ( PageNumber As Long, x As Long, y As Long,

    UseDefault As Boolean )

Parameters

Parameter
Description
PageNumber
Long. The page number of the report containing the graph where the event occurred.
x
Long. The X coordinate of the graph that was drilled on.
y
Long. The Y coordinate of the graph that was drilled on.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DrillOnGroup Event (CRViewer Object)

The DrillOnGroup event occurs when drilling down (double-clicking) on a group field viewer window.

Syntax

Event DrillOnGroup ( GroupNameList, DrillType As CRDrillType,

    UseDefault As Boolean )

Parameters

Parameter
Description
GroupNameList
An array containing all group names for the group drilled on.
DrillType
CRLoadingType (CRViewerLib)
. Specifies what type of object the  drill event occurred on (for example, graph, group tree, map, etc.).
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DrillOnSubreport Event (CRViewer Object)

The DrillOnSubreport event occurs when drilling down (double-clicking) on a subreport.

Syntax

Event DrillOnSubreport ( GroupNameList, SubreportName As String,

    Title As String, PageNumber As Long,

    Index As Long, UseDefault As Boolean )

Parameters

Parameter
Description
GroupNameList
An array containing all group names for the group drilled on.
SubreportName
String. Indicates the name of the subreport that was drilled on.
Title
String. Indicates the title of the subreport that was drilled on.
PageNumber
Long. Indicates the page number that the event occurred on.
Index
Long. Indicates the index of the subreport that was drilled on.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ExportButtonClicked Event (CRViewer Object)

The ExportButtonClicked event occurs when the Export button is clicked.

Syntax

Event ExportButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FirstPageButtonClicked Event (CRViewer Object)

The FirstPageButtonClicked event occurs when the button which navigates through the report to the first page is clicked.

Syntax

Event FirstPageButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GoToPageNClicked Event (CRViewer Object)

The GoToPageNClicked event occurs when a user requests and goes to a specific page in the report.

Syntax

Event GoToPageNClicked ( UseDefault As Boolean, PageNumber As Integer )

Parameters

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
PageNumber
Integer. The page number of the page that is to be displayed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GroupTreeButtonClicked Event (CRViewer Object)

The GroupTreeButtonClicked event occurs when the Group Tree button is clicked to show/hide the Group Tree in the viewer window.

Syntax

Event GroupTreeButtonClicked ( Visible As Boolean )

Parameter

Parameter
Description
Visible
Boolean. Indicates whether or not the Group Tree is now visible.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


HelpButtonClicked Event (CRViewer Object)

The HelpButtonClicked event occurs when the Help button is clicked.

Syntax

Event HelpButtonClicked ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


LastPageButtonClicked Event (CRViewer Object)

The LastPageButtonClicked event occurs when the button which navigates through the report to the last page is clicked.

Syntax

Event LastPageButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


NextPageButtonClicked Event (CRViewer Object)

The NextPageButtonClicked event occurs when the button which navigates through the report to the next page is clicked.

Syntax

Event NextPageButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


OnReportSourceError Event (CRViewer Object)

The OnReportSourceError event occurs when the report source (assigned to the CRViewer.ReportSource property) causes an error or cannot be loaded by the Report Viewer.

Syntax

Event OnReportSourceError ( errorMsg As String,

    errorCode As Long, UseDefault As Boolean )

Parameters

Parameter
Description
errorMsg
String. Indicates the error message.
errorCode
Long. Indicates the code or ID for the error.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PrevPageButtonClicked Event (CRViewer Object)

The PrevPageButtonClicked event occurs when the button which navigates through the report to the previous page is clicked.

Syntax

Event PrevPageButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


PrintButtonClicked Event (CRViewer Object)

The PrintButtonClicked event occurs when the Print button is clicked.

Syntax

Event PrintButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RefreshButtonClicked Event (CRViewer Object)

The RefreshButtonClicked event occurs when the Refresh button is clicked.

Syntax

Event RefreshButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SearchButtonClicked Event (CRViewer Object)

The SearchButtonClicked event occurs when the Search button is clicked.

Syntax

Event SearchButtonClicked ( searchText As String, UseDefault As Boolean )

Parameters

Parameter
Description
searchText
String. Indicates the data being searched for.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SearchExpertButtonClicked Event (CRViewer Object)

The SearchExpertButtonClicked event occurs when the Search Expert button is clicked.

Syntax

Event SearchExpertButtonClicked ( UseDefault As Boolean )

Parameter

Parameter
Description
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SelectionFormulaBuilt Event (CRViewer Object)

The SelectionFormulaBuilt event occurs when a new selection formula is assigned to the report. This event is not valid when the Report Viewer is used in conjunction with the Report Designer Component.

Syntax

Event SelectionFormulaBuilt

    selctionFormula As String, UseDefault As Boolean )

Parameters

Parameter
Description
selectionFormula
String. Indicates the new selection formula assigned to the report.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SelectionFormulaButtonClicked Event (CRViewer Object)

The SelectionFormulaButtonClicked event occurs when the Selection Formula button in the Report Viewer is clicked. This is not valid when the Report Viewer is assigned a report source produced by the Report Designer Component.

Syntax

Event SelectionFormulaButtonClicked

    selctionFormula As String, UseDefault As Boolean )

Parameters

Parameter
Description
selectionFormula
String. The current selection formula that will be replaced.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ShowGroup Event (CRViewer Object)

The ShowGroup event occurs when you click a group in the Group Tree.

Syntax

Event ShowGroup ( GroupNameList, UseDefault As Boolean )

Parameters

Parameter
Description
GroupNameList
An array containing all group names for the group selected.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


StopButtonClicked Event (CRViewer Object)

The StopButtonClicked event occurs when the user clicks the Stop button in the Report Viewer, forcing the Viewer to stop loading data from the report source.

Syntax

Event StopButtonClicked

    loadingType As CRLoadingType, UseDefault As Boolean )

Parameters

Parameter
Description
loadingType
CRLoadingType (CRViewerLib)
. Indicates what was being loaded into the Report Viewer when the Stop button was clicked.
UseDefault
Boolean. Indicates whether or not the default action of the event will be performed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ViewChanged Event (CRViewer Object)

The ViewChanged event occurs after the view in the Report Viewer has changed. Views refer to the main Preview Tab and drill down tabs that appear in the Report Viewer as the user interacts with the report.

Syntax

Event ViewChanged ( oldViewIndex As Long, newViewIndex As Long )

Parameters

Parameter
Description
oldViewIndex
Long. An index referring to the view the user switched from.
newViewIndex
Long. An index referring to the view the user switched to.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ViewChanging Event (CRViewer Object)

The ViewChanging event occurs when there has been a requeat for the view in the Report Viewer to change. Views refer to the main Preview Tab and drill down tabs that appear in the Report Viewer as the user interacts with the report.

Syntax

Event ViewChanging ( oldViewIndex As Long, newViewIndex As Long )

Parameters

Parameter
Description
oldViewIndex
Long. An index referring to the view the user is switching from.
newViewIndex
Long. An index referring to the view the user is switching to.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ZoomLevelChanged Event (CRViewer Object)

The ZoomLevelChanging event occurs when the zoom level of the Report Viewer is changed.

Syntax

Event ZoomLevelChanged ( ZoomLevel As Integer )

Parameter

Parameter
Description
ZoomLevel
Integer. A value indicating the new zoom level percentage.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRVTrackCursorInfo Object (CRVIEWERLib)

The CRVTrackCursorInfo Object contains information about the types of mouse cursors displayed while the user interacts with the report in the Report Viewer. This object corresponds to the TrackCursorInfo property in the CRViewer Object (CRVIEWERLib).

CRVTrackCursorInfo Object Properties

Property
Description
Read/Write
DetailAreaCursor
CRTrackCursor (CRViewerLib)
. Gets or sets the DetailAreaCursor type.
Read/Write
DetailAreaField
Cursor
CRTrackCursor (CRViewerLib)
. Gets or sets the DetailAreaFieldCursor type.
Read/Write
GraphCursor
CRTrackCursor (CRViewerLib)
. Gets or sets the GraphCursor type.
Read/Write
GroupAreaCursor
CRTrackCursor (CRViewerLib)
. Gets or sets the GroupAreaCursor type.
Read/Write
GroupAreaField
Cursor
CRTrackCursor (CRViewerLib)
. Gets or sets the GroupAreaFieldCursor type.
Read/Write
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


WebReportBroker Object (CRWEBREPORTBROKERLib)

The WebReportBroker Object is used internally by the Report Viewer to access web servers. In most applications, developers will not need to access this object directly.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


WebReportSource Object (CRWEBREPORTBROKERLib)

The WebReportSource Object contains information and methods related to the display of a report by the Report Viewer.

WebReportSource Object Properties

Property
Description
Read/Write
ImageType
Reserved. Do not use in current development. Gets or sets the image type.
Read/Write
PromptOnRefresh
Boolean. Gets or sets the prompt mode. If TRUE, the user will be prompted for new information each time the Report Viewer displays the report. If FALSE, the user will not get a prompt and the information provided with the previous prompt will be used, unless the server requires new information.
Read/Write
ReportSource
Unknown. Gets or sets the report source for the WebReportBroker.
Read/Write
Title
String. Gets or sets the report title that can be displayed in viewer.
Read/Write
URL
String. Gets or sets the URL source for the report.
Read/Write
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


WebReportSource Object Methods

The following methods are discussed in this section:

AddParameter Method (WebReportSource Object)

AddParameterEx Method (WebReportSource Object)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddParameter Method (WebReportSource Object)

Use AddParameter method to pass additional information for setting values for prompts in code as an alternative to prompting user to provide it. For example, you can provide user information which the server might request, rather than prompting the user to enter the information at runtime.

Syntax

Sub AddParameter ( tag As String, value As String )

Parameters

Parameter
Description
tag
String. Specifies the prompt for which you want to pass a value.
value
String. Specifies the response string that you want to provide.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddParameterEx Method (WebReportSource Object)

AddParameterEx method is not implemented for the current release. This method will allow you to pass more  information than AddParameter Method, which should be used at this time.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Enumerated Types - Report Viewer

The following enumerated types of the Report Viewer Object Model are discussed in this section:

CRLoadingType (CRViewerLib)

CRFieldType (CRViewerLib)

CRLoadingType (CRViewerLib)

CRObjectType (CRViewerLib)

CRTrackCursor (CRViewerLib)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDrillType (CRViewerLib)

Constant
Value
crDrillOnGraph
2
crDrillOnGroup
0
crDrillOnGroupTree
1
crDrillOnMap
3
crDrillOnSubreport
4
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRFieldType (CRViewerLib)

Constant
Value
crBoolean
5
crCurrency
4
crDate
6
crDateTime
8
crInt16
1
crInt32
2
crInt8
0
crNumber
3
crString
9
crTime
7
crUnknownFieldType
255
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRLoadingType (CRViewerLib)

Constant
Value
LoadingNothing
0
LoadingPages
1
LoadingQueryInfo
3
LoadingTotaller
2
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRObjectType (CRViewerLib)

Constant
Value
crBitmap
103 (&H67)
crBlob
104 (&H68)
crBox
106 (&H6A)
crCrossTab
110 (&H6E)
crCrosstabChart
108 (&H6C)
crCrosstabMap
115 (&H73)
crDatabaseFieldType
1
crDetailChart
109 (&H6D)
crDetailMap
116 (&H74)
crDetailSection
202 (&HCA)
crFormulaFieldType
5
crGraphic
111 (&H6F)
crGroupChart
107 (&H6B)
crGroupFooterSection
201 (&HC9)
crGroupHeaderSection
200 (&HC8)
crGroupMap
114  (&H72)
crGroupNameFieldType
8
crLine
105 (&H69)
crOLAPChart
113 (&H71)
crOLAPCrossTabFieldType
4
crOLAPDataFieldType
3
crOLAPDimensionFieldType
2
crOLAPMap
117 (&H75)
crOLEObject
101 (&H65)
crOOPSubreport
112 (&H70)
crPageFooterSection
206 (&HCE)
crPageHeaderSection
205 (&HCD)
crPromptingVarFieldType
9
crReportFooterSection
204 (&HCC)
crReportHeaderSection
203 (&HCB)
crSpecialVarFieldType
7
crSubreport
102 (&H66)
crSummaryFieldType
6
crText
100 (&H64)
crUnknownFieldDefType
0
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRTrackCursor (CRViewerLib)

Constant
Value
crAppStartingCursor
12
crArrowCursor
1
crCrossCursor
2
crDefaultCursor
0
crHelpCursor
13
crIBeamCursor
3
crMagnifyCursor
99
crNoCursor
10
crWaitCursor
11
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Report Viewer/Java Bean Technical Reference

The following Properties, Methods, and Events are discussed in this section:

 	The Report Viewer/Java Bean Properties

 	The Report Viewer/Java Bean Methods

 	closeCurrentView

 	exportView

 	printView

 	refreshReport

 	searchForText

 	showLastPage

 	showPage

 	stopAllCommands

 	The Report Viewer/Java Bean Events

 	ServerRequestEvent

 	ViewChangeEvent

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Report Viewer/Java Bean Properties

The Report Viewer Bean properties may have one or more of the characteristics listed below:

 	read: you can get the current value.

 	write: you can set the value.

 	bound: you can get a notification every time the value changes.

 	constrained: you can veto a request to change the value.

Property
Description
Read(r), Write(w),
Bound(b), Constrained(c)
busy
Boolean. True if the ReportViewer is currently processing a command initiated by user action, method call, or property change.
r, b
canCloseCurrentView
Boolean. True if the current views tab can be closed. The initial ("Preview") tab cannot be closed. Refer to method closeCurrentView.
r,b
canDrillDown
Boolean. True if drill-down views can be opened. Normally, clicking on a hidden group in the group tree (indicated by a magnifying glass icon next to the group name) or double-clicking on a chart or map or group section in the page will open a drill-down view.
r,w,b,c
currentMessage
string. The message currently displayed in the status area of the toolbar.
r,b
currentPageNumber
int
.
The number of the page currently being viewed.
r,b
currentTip
string
.
The "tool tip" currently displayed in the status area of the toolbar. Tool tips temporarily override any message in the status area
.
r,b
currentViewName
string
.
The name of the view whose tab is selected.
r,b
exportingPossible
Boolean. False if exporting is not possible because the user has denied the bean permission to write to the local disk.
r
hasExportButton
Boolean
.
 True if the Export button can be made visible in the toolbar. If exporting is not possible (refer to property
exportingPossible
 ), requests to set this property to True will be vetoed.
r,w,b,c
hasGroupTree
Boolean
.
 If set to True then the GroupTree toggle button is made visible in the toolbar and the GroupTree can be displayed (refer to property
showGroupTree
).
r,w,b,c
hasPrintButton
Boolean
.
 If True then the Print button will be visible in the toolbar. If printing is not possible (refer to property
printingPossible
) then requests to set this property to True will be vetoed.
r,w,b,c
hasRefreshButton
Boolean
.
 If True then the Refresh button is visible in the toolbar.
r,w,b,c
hasToolBar
Boolean
.
 If True then the toolbar is visible.
r,w,b,c
hasTextSearch
Controls
Boolean
.
 If True then the Text Search field and the Find Next button are visible in the toolbar.
r,w,b,c
language
string
.
 Contains the 2 letter international Standard code for the language to be used for the user interface. Languages currently supported are:
   English        --    en
   French         --    fr
   German       --    de
   Japanese      --    ja
   Italian          --    it
   Spanish        --    es
   Portuguese  --    pt
r,w,b,c
lastPageNumber
int
.
 Indicates to the highest numbered page currently available in the report. This may or may not be the final page. (refer to property
lastPageNumberKnown
).
r,b
lastPageNumber
Known
Boolean. True if the number of the final page in the report is known. If False then there are more pages in the report than the lastPageNumber property indicates.
r,b
printingPossible
Boolean
.
 True if printing is possible. If False then either the Java implementation doesn’t support it or the user has denied the bean permission to print.
r
reportName
string
.
The URL of the report to be viewed. For example:
http://server_name/report_dir/report.rpt
Setting this property causes the ReportViewer to request page 1 of the report from the server.
r,w,b,c
searchText
string
.
 Contains the text most recently searched for, or  the text being typed by the user int to the Text Search field in the toolbar.
r,b
selectionFormula
string
.
 The current selection formula to be used for subsequent commands. The formula is expressed in the Crystal Reports formula language. Setting this property closes all views except the initial one (the "Preview" view), discards all information cached for the report, and re-requests the current page of the report.
r,w,b,c
showGroupTree
Boolean
.
 If True and the
hasGroupTree
property is True then the GroupTree will be visible.
r,w,b,c
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Report Viewer/Java Bean Methods

Each of the methods in the Report Viewer Bean starts what may be a lengthy operation, and they return to the caller before that operation is complete. If it is important to know when the command begun by one of these methods is finished, the calling code should watch for the associated events or property change notifications.

Generally there will be a time delay between the method call returning and the associated event being fired or the property changing. In fact, there may be a delay in beginning the command if the report viewer is busy processing a previous command. Commands are begun strictly one at a time in the order they are generated although, once begun, they may be processed in parallel in different threads.

The events and property change notifications will be given to the calling code on a different thread from the one that made the method call.

closeCurrentView

exportView

printView

refreshReport

searchForText

showLastPage

showPage

stopAllCommands

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


closeCurrentView

If the canCloseCurrentView property is True, closes the current view. Equivalent to the Close button in the toolbar. A viewClosed and a viewActivated event are fired. The currentViewName property is changed.

Syntax

void closeCurrentView ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


exportView

If the exportingPossible property is True, requests the report from the server in the indicated format and writes it to the local disk. Similar to the Export button in the toolbar.

Syntax

void exportView ( int exportFormat, File destinationFile )

Parameters

exportFormat
Specifies the format in which the requested report should appear.
Constant
Value
toHTML
0
toCrystalReport
1
toMSWord
2
toMSExcel
3
destinationFile
Complete pathname of the destination file.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


printView

If the printingPossible property is True, prints all pages in the current view, requesting them from the server if necessary. Equivalent to the Print button in the toolbar.

Syntax

void printView ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


refreshReport

Closes all views except the initial one (the "Preview" view), discards all information cached for the report, and re-requests the current page of the report.

Syntax

void refreshReport ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


searchForText

Displays the next occurrence of the indicated text in the report output. Equivalent to the text search field in the toolbar. Currently, the second and third parameters are ignored; the search is always forward and case-insensitive. The searchText property is changed.

Syntax

void searchForText ( String searchString, boolean forwardSearch,

    boolean caseSensitive )

Parameters

searchString
The string for which you want to search.
forwardSearch
This parameter is ignored.
caseSensitive
This parameter is ignored.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


showLastPage

Shows the last page of the report, requesting it from the server if necessary. Equivalent to the Last Page button in the toolbar. The lastPageNumber and lastPageNumberKnown properties may be changed.

Syntax

void showLastPage ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


showPage

Displays the indicated page, requesting it from the server if necessary. Equivalent to the page number field in the toolbar. The currentPageNumber property is changed.

Syntax

void showPage ( int pageNumber )

Parameter

pageNumber
Number of the page to be displayed.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


stopAllCommands

Cancels all unfinished commands. Equivalent to the Stop button in the toolbar.

Syntax

void stopAllCommands ()

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Report Viewer/Java Bean Events

There are 2 event classes defined by the Report Viewer Bean and discussed in this section: class ViewChangeEvent and class ServerRequestEvent.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ServerRequestEvent

Description
Properties
ListenerInterface Methods
Indicates a request has been sent to the server owning the current report.
string ServerURLstring Parameter
requestStarted(
event
 e)
requestEnde(
event
e)
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ViewChangeEvent

Description
Properties
ListenerInterface Methods
Indicates that a view has changed.
string viewName
viewOpened(
event
 e)
viewActivated(
event
 e)
viewClosed(
event
 e)
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Embeddable Crystal Reports Designer Control Object Model

The Embeddable Crystal Reports Designer Control (Embeddable Designer) is a new addition to the Report Designer Component; it enables you to provide a Crystal Reports designer in your application. In this section, you will find a general overview of the control as well as detailed information on its properties and methods.

Click the appropriate link to jump to that section:

 	Overview of the Embeddable Designer

 	Application development with the Embeddable Designer

 	Distributing the Embeddable Designer

 	Properties and methods of the Embeddable Designer

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview of the Embeddable Designer

Your users can now design or edit reports at runtime with the Embeddable Designer. This easy-to-use ActiveX control provides the full power of Crystal Reports to your application. The control is placed on a form, or in a container within the form, and displays a new or existing report in design mode. This presents the user with an interactive environment in which to design or edit the report. The Embeddable Designer allows users to:

 	add data sources

 	add database fields

 	create and add formulas

 	create and add parameters

 	group data

 	summarize data

 	add charts

 	add subreports

 	add special fields

 	format fields and sections.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Application development with the Embeddable Designer

The Embeddable Designer is an ActiveX control that can be added to any development environment that supports ActiveX. Using Microsoft Visual Basic, Microsoft Visual C++, Delphi, and Borland C++, you can now add a Crystal Reports designer to your application with minimal code.

As a standard component, the Embeddable Designer not only exposes several properties at design time, but also provides a complete set of properties, methods, and events that can be programmed at runtime. An application using the Embeddable Designer will consist of three components. These three components allow the user to create, design, preview, print, export, and save their reports.

 	The Embeddable Designer, also known as the Embeddable Crystal Reports 8.5 Designer Control (Crdesignerctrl.dll), is a front-end user interface for designing or editing new or existing reports. See Programming the Embeddable Crystal Reports Designer Control for tutorials on creating applications with the Embeddable Designer.

 	The Automation Server, also known as the Crystal Reports 8.5 ActiveX Designer Design and Runtime Library (Craxddrt.dll), is an extensive object model with hundreds of properties and methods that you can use to program a report. See Report Designer Component Object Model for more information.

Note: The Craxddrt.dll must only be used in a client-side application. See Unification of the RDC object model for more information.

 	The Report Viewer, also known as the Crystal Reports Viewer Control (Crviewer.dll), is a front-end user interface for viewing reports. See Programming the Crystal Report Viewers for more information.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Distributing the Embeddable Designer

Distribution of an application consists of three main DLLs: Crdesignerctrl.dll, Craxddrt.dll, and Crviewer.dll. In addition to these main DLLs, you will need to distribute the standard runtime files, including database DLLs and export DLLs. The additional DLLs you distribute will vary depending on your application. For more information on standard runtime files, refer to the Runtime help file (Runtime.hlp).

Note: The Embeddable Designer is not royalty free; it requires licensing. For more information on licensing, refer to the License help file (License.hlp).

Providing online help for the Embeddable Designer

Although online help for designing reports at runtime in the Embeddable Designer is not provided, you can provide your own online help to your users. The Embeddable Designer has access to online help through the Help button on the main toolbar and through the Help command in the shortcut menu. You can enable or disable the Help button and hide the Help menu through the EnableHelp property (Microsoft Visual Basic) or the SetEnableHelp function (Microsoft Visual C++). To set your help file to the Embeddable Designer, create the following registry key:

Key Name

HKEY_LOCAL_MACHINE\SOFTWARE\Seagate Software\Report Designer Component

Value Name

CrdesignerctlHelpPath

Value Data

Provide the full path and name of your help file here.

The Embeddable Designer uses the WinHelp function to start Microsoft Windows Help. The following table lists the various help options available and the UCommand used in the WinHelp function based on the help option selected. Keep this in mind when creating your online help.

Note: The online help must be a WinHelp file (.hlp).

Option Location
UCommand
Menu: Help > Crystal Reports Help
HELP_INDEX
Menu: Help > Search
HELP_FINDER
Menu: Help > Using Help
HELP_HELPONHELP
Toolbar: Help
HELP_INDEX

For a complete description of the WinHelp function see “WinHelp Shell and Common Controls: Platform SDK” in the Microsoft Developer Network (MSDN).

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Properties and methods of the Embeddable Designer

In Microsoft Visual Basic, the properties of the Embeddable Designer are Read/Write. In Microsoft Visual C++, the corresponding functions will have Set and Get prefixed to the property name. Set writes to the property, and Get reads from the property. Methods and events have the same names in both environments.

Note: Only the properties and methods of the CCRDesignerCtrl class (main class for the Embeddable Designer) are included. Information on properties, methods, and events for the base classes can be found in the Microsoft Developer Network (MSDN).

Microsoft Visual Basic Example

Dim bShowGrid As Boolean

'Get the value of the DisplayGrid property

bShowGrid = CRDesignerCtrl1.DisplayGrid

'If the Grid is displayed Set the DisplayGrid

'property to False

If bShowGrid Then CRDesignerCtrl1.DisplayGrid = False

Microsoft Visual C++ Example

BOOL bShowGrid;

// Get the value for the DispalyGrid property

bShowGrid = m_Designer.GetDisplayGrid();

// If the Grid is displayed Set the DisplayGrid

// property to False

if(bShowGrid) m_Designer.SetDisplayGrid(FALSE);

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Embeddable Designer (Properties)

Property
Data type and description
Read/Write
CaseInsensitiveSQLData
Boolean. Specifies whether or not to perform a case insensitive search for SQL data.
Read/Write
ConvertDateTimeType
CRConvertDateTimeType. Gets or sets the report option that specifies the format to be converted for date / time fields.
Read/Write
ConvertNullFieldToDefault
Boolean. Specifies whether or not to convert NULL parameter fields to their default values.
Read/Write
DisplayFieldView
Boolean. Gets or sets whether or not the field view is available. The field view is the list of available fields for the report, including Database, Formula, Parameter, Group Name, Running Total, Special, and Unbound fields.
Read/Write
DisplayGrid
Boolean. Gets or sets whether or not the grid is displayed.
Read/Write
DisplayHiddenSections
Boolean. Gets or sets whether or not a section is available when hidden.
Read/Write
DisplayRulers
Boolean. Gets or sets whether or not the Ruler is available.
Read/Write
DisplayToolbar
Boolean. Gets or sets the visibility of the tool-bar.
Read/Write
EnableHelp
Boolean. Gets or sets the availability of the help options. When True, the Help icon on the toolbar is enabled and the Help command is visible in the shortcut menu. When False, the Help Icon on the toolbar is disabled and the Help command is hidden in the shortcut menu.
Read/Write
EnableSnapToGrid
Boolean. Specifies whether or not to automatically align any fields you insert or to resize to the nearest grid coordinate.
Read/Write
GridSize
Single. Gets or sets the size of the grid in inches. Default value is 0.083.
Read/Write
ReportObject
ReportObject. Gets or sets the report object.
Read/Write
TranslateDosMemos
Boolean. Gets or sets the report option that indicates whether or not to translate DOS memos.
Read/Write
TranslateDosStrings
Boolean. Gets or sets the report option that indicates whether or not to translate DOS strings.
Read/Write
UseIndexForSpeed
Boolean. Gets or sets the “Use Indexes or Server for Speed” option during record selection report option.
Read/Write
VerifyOnEveryPrint
Boolean. Gets or sets the report option that indicates whether or not to verify the database every time the report is run.
Read/Write
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Embeddable Designer (Methods)

SaveReport Method

Use the SaveReport method to the save the report to Crystal Reports format.

Syntax

Sub SaveReport (ReportName as String)

Parameter

Parameter
Description
ReportName
Specifies the file path and name that you want to save the report to.
Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Active Data

This section provides information on using active data in the Crystal Reports Development environment. Three areas are covered; the active data driver, Crystal Data Object, and Crystal Data Source Type Library. By reading these sections you will learn how to create active data reports, create recordsets, and connect to the datasource through the Report Designer Component automation server.

Click the appropriate link to jump to that section:

 	Active Data Driver

 	Crystal Data Object

 	Crystal Data Source Type Library

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Active Data Driver

Modern Visual Basic applications often use advanced ActiveX components to connect to data sources. These data sources may include Data Access Objects (DAO), Remote Data Objects (RDO), OLE DB providers, such as ActiveX Data Objects (ADO), or the Visual Basic data controls. Using the Active Data Driver for Crystal Reports, you can design reports for your Visual Basic applications that use these same ActiveX data sources. The Active Data Driver also supports Crystal Data Objects (CDO) and the Crystal Data Source Type Library. For more information on RDO, DAO, and ADO, refer to Microsoft documentation. For information on the Data Control, refer to your Visual Basic documentation. For information on CDO, see Crystal Data Object. For information on the Crystal Data Source Type Library, see Crystal Data Source Type Library.

Occasionally, you may also need to create a report when the data source is not actually available at design time. Highly dynamic data may only be available at runtime. In such cases, the Active Data Driver supports the use of Data definition files, tab separated text files that define the fields in a data source but not the actual data.

Normally, developing applications using the Report Designer Component requires designing and saving one or more report files in advance to be accessed by the application at runtime. This process requires that the programmer has access to the data during design time, and that the application, upon installation, also installs whatever database drivers and files are required to make sure the reports can connect to the required data.

An alternative to runtime connectivity, of course, is to save data with the report files. The data is neatly packaged and available whenever the report is requested from your custom application. However, saving data with a report increases the file size of the report, wasting disk space. Furthermore, this technique produces a static report file in which the data cannot be updated without connectivity to the database.

The Crystal Active Data Driver allows you to create report files at design time without specifying an actual data source. Instead, the report is based on a data definition file, an ASCII text file with place holders to represent database fields. At runtime, you add code to your application to specify the actual source of data for the report.

The following topics are discussed in this section:

 	Data Definition Files

 	Using the Active Data Driver

 	Creating Data Definition Files

 	Using ActiveX Data Sources at Design Time

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Data Definition Files

A report file designed using a data definition file, instead of a specific database or ODBC data source, contains information about the kind of data to place in the report instead of information about an actual data source. It looks for field types, rather than actual fields. For an example of a data definition file, refer to the file ORDERS.TTX installed in the \Program Files\Seagate Software\Crystal Reports directory.

At design time, you create your report based on the data definition file. Previewing or printing the report at design time has little value except to format field placement and style. Since there is no real data in the text file, you cannot preview or print any data at design time.

Note: You can add sample data to the data definition file so that values will appear for each field in the Preview Tab at design time, but the values will be identical for all records, and grouping will not be available.

At runtime, your application opens the report file, just as it would any other report file. Instead of simply formatting and printing the file at runtime, though, you change the data source pointed at by the Crystal Active Data Driver, which is the data definition file, to a Recordset or Rowset object for an ActiveX data source such as ADO, RDO, DAO, or the Crystal Data Sources (see Crystal Data Object), and the Crystal Data Source Type Library (see Crystal Data Source Type Library).

Once the Crystal Active Data Driver obtains the Recordset from the runtime data source, the Report Designer Component can generate the actual report using existing data. The entire process saves you time designing reports and produces reports that are much more flexible and portable at runtime. For more information on data definition files, see Creating Data Definition Files.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using the Active Data Driver

Designing and generating reports using the Crystal Active Data Driver is a straightforward process, but requires several specific steps:

 	Select the design time data source

 	Design the Report

 	Obtain a Recordset from the Runtime Data Source

 	Open the Report

 	Pass the Recordset to the Active Data Driver

 	Print the Report

The following sections demonstrate this process using the Crystal Active Data Driver with the Report Designer Component Automation Server in Visual Basic 6.0.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Select the design time data source

When designing a report for your Visual Basic application, you can specify any ActiveX data source using the Active Data Driver, or you can specify a data definition file so that the actual data is specified at runtime only. The following example uses the sample data definition file included with Crystal Reports:

1	Click New Report in the Crystal Reports Welcome dialog box, or click the New button on the Crystal Reports toolbar.

2	In the Crystal Report Gallery dialog box click Using the Report Expert. In this example, you can click Standard from the Choose an Expert box. Then Click OK.

3	In the Standard Report Expert Dialog box click Database.

4	In the Data Explorer dialog box:

 	expand More Data Sources

 	expand Active Data

 	expand Active Data (ADO).

5	In the Select Data Source dialog box click the ODBC (ADO) option, select Xtreme Sample Database from the drop-down list, and then click OK.

6	In the Data Explorer dialog box click Add.

7	In the Select Recordset dialog box select Orders from the Object list, and then click OK.

8	In the Data Explorer dialog box click Close. The Orders table appears as ado in the Tables available for report box, under the data tab, in the Standard Report Expert dialog box.

Note: For information on specifying an OLE DB provider or other ActiveX data source at design time, see Using ActiveX Data Sources at Design Time.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Design the Report

Once you have selected a data definition file or an ActiveX data source, you can design your report just as you would design any other report.

1	Click the Fields Tab of the Standard Report Expert.

The data definition file orders appears as a database table in the Database Fields list box. Each of the fields defined in orders.ttx appears as a field in the orders table.

2	Add fields to your report just as you would normally add fields to a report using the Standard Report Expert.

3	Continue designing the report using the Standard Report Expert. When finished, click Design Report. Since the report is based on a data definition file, there is no point in previewing it at this time.

4	Apply any formatting or other changes that you feel are necessary to fine-tune the look of your report. Save the report when finished.

Note: Before saving your report, be sure to turn off the Save Data with Report option under the File menu. The sample data stored with the data definition file is unnecessary at runtime, and will only increase the size of your report file.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Obtain a Recordset from the Runtime Data Source

Once you have selected a data source or data definition file and designed a report based on that data source or file, you can begin programming your Visual Basic application to obtain a recordset from an ActiveX data source, open the report file, set the report file to use the recordset object from the ActiveX data source, then print or export the report file. This process requires using the functionality of the Crystal Active Data Driver in conjunction with the Report Designer Component or one of the other Crystal Reports development tools. See the "Visual Basic Solutions" chapter in the Technical Reference Guide (techrRef.pdf), or the Crystal Reports Developer Guide (CrystalDevHelp.chm) for more information on the other Crystal Reports development tools.

The following tutorials use the Report Designer Component Automation Server in Visual Basic 6.0. This section assumes a familiarity with the Report Designer Component Automation Server. If you need more information on how to use the automation server, see the Report Designer Component Object Model.

To begin, you must obtain a Recordset object from a runtime ActiveX data source. This data source can be opened through DAO, RDO, ADO, the Visual Basic Data Control, Crystal Data Objects (CDO), or a class that implements the Crystal Data Source Type Library. For information on DAO, RDO, and ADO, refer to Microsoft documentation. For information on the Visual Basic Data Control, refer to your Visual Basic documentation. For information on CDO, see Crystal Data Object. For information on the Crystal Data Source Type Library, see Crystal Data Source Type Library.

This tutorial creates a Recordset object from the Orders table of the XTREME.MDB sample database using DAO. The Recordset concept is used by DAO, ADO, and the Crystal Data Source Type Library. If you are using RDO, you will need to obtain a rdoResultSet object. If you are using CDO, you will need to obtain a Rowset object (see Crystal Data Object).

Note: You must add the Data Access Objects component to your Visual Basic project before performing the following steps. For instructions on using DAO with Visual Basic, refer to your Visual Basic documentation.

 	Declare variables for the Database and Recordset objects in your Visual Basic application. This can be handled in the declarations section of a form or module. Use code similar to this:

Dim db As New DAO.Database

Dim rs As DAO.Recordset

 	Obtain a Database object from the Xtreme database.

Set db = DBEngine.Workspaces(0).OpenDatabase( _

"c:\Program Files\Seagate Software\Crystal Reports\xtreme.mdb")

 	Obtain a Recordset object from the Orders table of the Xtreme database.

Set rs = db.OpenRecordset("Orders", dbOpenTable)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Open the Report

Once you have obtained a Recordset object, you can begin working with the report file you created earlier. This example uses the Report Designer Component Automation Server to open a report file.

Note: You must add the Report Designer Component Automation Server component to your Visual Basic project before performing the following steps.

 	Declare variables for the Application and Report objects that you will obtain from the Report Designer Component Object Library in the automation server. This can be handled in the declarations section of a form or module.

Dim CRXApplication As New Craxdrt.Application

Dim CRXReport As Craxdrt.Report

 	Obtain a Report object by opening the report file you created earlier. This example uses the file ORDERS.RPT.

Set CRXReport = CRXApplication.OpenReport("c:\reports\Orders.rpt", 1)

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Pass the Recordset to the Active Data Driver

The Recordset object gets passed to the Active Data Driver through the SetDataSource method of the Database object in the Report Designer Component Object Library. You must first obtain a Database object from the Report object, then you must use the SetDataSource method to set the report to point at the recordset object for your Active data source. The Report Designer Component Automation Server uses the Active Data Driver itself to replace the data definition file, at runtime, with the Active data source.

The following code demonstrates how to obtain a Database object from the Report object:

Dim CRXDatabase As Craxdrt.Database

Set CRXDatabase = CRXReport.Database

Once you have a Database object for the Report object, you can pass the Active data source to the Report object using the SetDataSource method. This method requires three parameters. The first is the data source itself. The second parameter is a value indicating that the data source you are passing to the report is an ActiveX data source. This value must be 3. The third is the table you are passing the data source to. Since you should only have one table defining the structure of the recordset, this should always be 1. For example:

CRXDatabase.SetDataSource rs, 3, 1

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Print the Report

Now that the data source for the report has been set to the DAO Recordset, you can print, preview, or export the report normally. For instance, the following code prints the report to the default printer:

CRXReport.PrintOut

Once the data source has been set in the report object, runtime reporting can proceed normally. All features of the Report Designer Component are available to you. See Report Designer Component Object Model for more information.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Creating Data Definition Files

A data definition file is a tab-separated text file that contains information about field names, field types, and sample field data. Field names used in the data definition file must match the field names that will appear in the ActiveX data source that is specified at runtime. Field type information indicates the type of data in each field (string, numeric, date, etc.) and, if it is a string field, the maximum length of the string. Finally, sample field data is simply sample data that Crystal Reports can display in the preview window while you design the report.

For complete information on creating data definition files, see Creating Data Definition Files. Crystal Reports installs a sample data definition file in the \Program Files\Seagate Software\Crystal Reports directory on your system. This file is named ORDERS.TTX and can be used with the Orders table in the XTREME.MDB sample database or the Xtreme sample data ODBC data source that was created when you installed Crystal Reports.

The Active Data Driver supports the following data types in a data definition file:

Data Type
Description
BLOB
Fields that contain bitmap images.
Boolean
True/False Boolean value.
Byte
8-bit integer value.
Currency
64-bit floating-point value that can include a currency or percent sign.
Date
Any date/time value. Examples include:
Jan 5, 1999
07/11/97 5:06:07
07/11/97
23:30:01
Long, int32
32-bit integer value.
Memo
Any string value over 254 characters long. You must indicate the maximum number of characters for the string.
Number
64-bit floating-point value.
Short, int16
16-bit integer value.
String
Any string value under 254 characters long, such as a name, description, or identification number that is not meant to be interpreted numerically. You must indicate the maximum number of characters for the string.
Note:  The data type BLOB is supported when connecting to RDO, ADO, DAO and the data control at runtime but not when connecting to CDO.

Although data definition files can be created manually using a text editor such as Notepad, Crystal Reports provides tools for simplifying the process. Each tool has its advantages. Review the process for using each tool described below to determine which best suits your own environment and development process.

 	Database Definition Tool

 	Active Data Driver Functions

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Database Definition Tool

The Database Definition Tool is available from the Select Data Source dialog box when you begin designing a report based on the Active Data Driver. This tool allows you to design a data definition file as the first step of designing your report. From the Standard Report Expert:

1	In the Standard Report Expert click Database.

2	In the Data Explorer dialog box:

 	expand More Data Sources

 	expand Active Data

 	expand Active Data (Field Definitions Only).

3	In the Select Data Source dialog box click New to create a new data definition file.

The Database Definition Tool appears.

4	Use the Database Definition Tool to create fields for your data definition file.

Use the controls to enter field names, field types, and sample data that will appear in the Crystal Reports Preview Tab. If you select String as the field type, you will also be asked to specify a maximum string length.

5	Click Add to add each new field to your data definition file. Each field appears in the list box at the bottom of the Database Definition Tool.

6	Continue adding as many fields as necessary for your data definition file by entering the information in the controls of the Database Definition Tool, and clicking Add each time.

7	You can delete a field that you have created by selecting the field in the list box and clicking Delete.

8	Click the Close button in the upper right of the Database Definition Tool dialog box when you are finished designing your data definition file. A message appears asking if you want to save the data definition file.

9	Click Yes, and a Save File As dialog box appears.

10	Save the data definition file where it can be accessed by your report file. When finished, the new data definition file will appear in the Data Definition text box in the Select Data Source dialog box.

11	Continue creating your report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Active Data Driver Functions

The Active Data Driver (P2SMON.DLL) is a standard dynamic link library that is normally used by Crystal Reports (or the Report Designer Component) to access ActiveX data sources such as DAO and ADO. The DLL is installed, by default, in your \WINDOWS\SYSTEM directory. In addition, the Active Data Driver exports functions that can be used at runtime from within your application to dynamically design a data definition file based on your data source, and a report file based on the data definition file. These functions are available to any development environment that supports DLL function calls.

Note: To use the functions in the Active Data Driver DLL, you must declare the functions first. Refer to your Visual Basic documentation for information on declaring DLL functions. See The Crystal Active Data Driver Reference for information about declaring the Active Data Driver functions.

To use the Active Data Driver Functions from Visual Basic:

1	Obtain a valid Recordset object from your DAO, ADO, or Data Control data source, or a valid Rowset object using CDO.

2	Call the function CreateReportOnRuntimeDS to create a data definition file based on your Recordset or Rowset object. For example:

CreateReportOnRuntimeDS(daoRs, "c:\reports\orders.rpt",

    "c:\reports\orders.ttx", True, False)

This example creates a data definition file named ORDERS.TTX, then creates a simple report file based on this data definition file and names it ORDERS.RPT. If the last argument is set to True, Crystal Reports, if installed on the system, will open automatically on the user’s machine, allowing them to make changes to the report file.

Notice that the first argument is a DAO Recordset object. If you are using this function in a language such as C or C++, you would pass a pointer to an IUnknown derived interface to the Recordset.

Note: See The Crystal Active Data Driver Reference for complete information on the functions provided by the Active Data Driver.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using ActiveX Data Sources at Design Time

The Active Data Driver is intended to allow reports to be based on ActiveX data sources such as ADO and DAO. Data definition files allow you to avoid specifying an actual data source until runtime. However, you may often need to simply specify an ADO data source at design time for the report.

The Select Data Source dialog opens when you select one of the active data folders in the More Data Sources\Active Data folder in the Data Explorer. This dialog box provides four options for selecting a data source to use in your report: specify an ODBC data source for ADO or RDO, specify an ADO connection string for OLE DB, specify a DAO recordset, or specify a data definition file. The Data Definition option has been thoroughly discussed earlier in this section. The remainder of this section will discuss selecting an ADO, RDO, or DAO data source.

The following topics are discussed in this section:

 	ODBC with ADO and RDO

 	ADO and OLE DB

 	DAO

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ODBC with ADO and RDO

1	Click the ODBC option in the Select Data Source dialog box.

This option allows you to connect to an ODBC data source through ADO or RDO. The currently selected data objects technology appears in parentheses next to the ODBC option.

 	Use the drop-down list to select an ODBC data source that is available on your system.

 	Click the New button to create a new ODBC data source. Refer to Microsoft ODBC documentation for information on creating ODBC data sources.

 	Click the Advanced button to select ADO or RDO as the data objects technology used. This should match the technology used in your Visual Basic application.

2	After you select your data source and data objects technology, you can click Next in the Select Data Source dialog box.

The Select Recordset dialog box appears.

3	If the ODBC data source requires log on information, specify a user name and password to log on.

4	Determine if you want to create a Recordset or Resultset using an object available from your data source, such as a database table, or if you prefer to specify a SQL statement. Select the appropriate option in the Recordset section of the Select Recordset dialog box.

Note: For simplicity, RDO Resultsets are also referred to as Recordsets in this dialog box.

5	If you want to connect to a database object, use the Object Type drop-down list box to select the type of database object, such as a Table, then select the object itself from the Object drop-down list box.

6	If you want to obtain a Recordset using a SQL statement, write the SQL statement in the text box provided, or click Build to use the Microsoft Query application and Query Wizard to visually design your SQL statement.

7	Click Finish in the Select Recordset dialog box. Either ado or rdo will appear in the list box on the Data Tab of the Standard Report Expert.

8	Continue creating your report normally. While creating your report, the ado or rdo specification will act like a database table, providing all fields that have been obtained from your ADO Recordset or RDO Resultset.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


ADO and OLE DB

1	Click the ADO and OLE DB option in the Select Data Source dialog box. This option is designed to allow you to specify an ADO connection string that can connect to any OLE DB provider.

2	Type the ADO connection string into the text box provided, or click Build to open the Datal Links Properties dialog box. The following are examples of an acceptable connection string for ADO:

DSN=Xtreme sample data;

DATABASE=pubs;DSN=Publishers;UID=sa;Password=;

3	Type in the first example shown here to follow along in this tutorial. Click Next in the Select Data Source dialog box when finished. The Select Recordset dialog box appears.

4	Determine if you want to create a Recordset using an object available from your data source, such as a database table, or if you prefer to specify a SQL statement. Select the appropriate option in the Recordset section of the Select Recordset dialog box.

5	If you want to connect to a database object, use the Object Type drop-down list to select the type of database object, such as a Table, then select the object itself from the Object drop-down list.

6	If you want to obtain a Recordset using a SQL statement, write the SQL statement in the text box provided, or click Build to use the Microsoft Query application and Query Wizard to visually design your SQL statement.

7	Click Finish in the Select Recordset dialog box. You will see ado in the list box on the Data Tab of the Standard Report Expert.

8	Continue creating your report normally. While creating your report, the ado specification will act like a database table, providing all fields that have been obtained from your ADO Recordset.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DAO

1	Click the DAO option in the Select Data Source dialog box. This option allows you to connect to a database file through Data Access Objects (DAO).

2	Select a database type from the Database drop-down list box. This list displays all DAO compatible database drivers installed on your system. Crystal Reports installs many DAO drivers for you. For this example, you can select Access as the database type.

3	Use the Browse button to open the Select Database File dialog box. Use this dialog box to locate and select a database file. Crystal Reports includes several sample databases in the \Program Files\Seagate Software\Crystal Reports directory by default. You can select the XTREME.MDB Access file from this directory for this example.

4	Click Open in the Select Database File dialog box, and the path and file name of the database you selected appear in the DAO text box on the Select Data Source dialog box.

5	Click Next, and the Select Recordset dialog box appears.

6	If the database requires log on information, specify a user name and password to log on.

7	Determine if you want to create a Recordset using an object available from your database, such as a database table, or if you prefer to specify a SQL statement. Select the appropriate option in the Recordset section of the Select Recordset dialog box.

8	If you want to connect to a database object, use the Object Type drop-down list to select the type of database object, such as a Table, then select the object itself from the Object drop-down list.

9	If you want to obtain a Recordset using a SQL statement, write the SQL statement in the text box provided and click Next.

10	Click Finish in the Select Recordset dialog box. You will see dao in the list box on the Data Tab of the Standard Report Expert.

11	Continue creating your report normally. While creating your report, the dao specification will act like a database table, providing all fields that have been obtained from your DAO Recordset.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Object

The Crystal Data Object (CDO) is an ActiveX data source that allows you to define fields and records at runtime based on data that exists only at runtime. Through CDO, any data can become a virtual database and can be reported on using the power of the Report Designer Component. The Crystal Data Object does not support Memo or Blob fields.

CDO, like DAO and ADO, is based on the Component Object Model (COM). Any development environment that supports COM interfaces can dynamically generate a set of data for a report without relying on a database that exists at design time.

Applications that produce data that does not exist outside of the running application have been unable, until now, to take advantage of the most powerful reporting features in the industry. CDO, however, solves that problem. For instance, applications that monitor system or network resources, or any constantly operating environment, can produce a current report on such information at any time. No longer does data need to be dumped to a separate database before analysis. Through CDO, the Active Data Driver, and the Report Designer Component, analysis is instant and up-to-date.

The following topics are discussed in this section:

 	CDO vs. the Crystal Data Source Type Library

 	Using the Crystal Data Object

 	Crystal Data Object Model

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CDO vs. the Crystal Data Source Type Library

Crystal Reports also supports the Crystal Data Source Type Library, for implementing in a Visual Basic class definition. Crystal Data Source objects can also be passed to the Active Data Driver as ActiveX data sources. However, the Crystal Data Source Type Library exposes a complete COM interface that must be implemented in your class. CDO, on the other hand, provides a fast and simple method for producing an internal customized ActiveX data source.

If you need to implement a complete data source in your application that allows runtime movement through records and fields, or if you intend to implement your data source as a separate ActiveX component, consider using the Crystal Data Source Type Library. However, if you need to create a quick and simple means of storing a large amount of data in a convenient package for reporting on, and the data will remain inside the same application as the reporting functionality, then use Crystal Data Objects.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using the Crystal Data Object

The Crystal Data Object is an ActiveX DLL that can be accessed from any Windows development environment that supports ActiveX. By creating a Rowset object, similar to a Recordset, and filling it with fields and data, you design a virtual database table that can be passed as an ActiveX data source to the Crystal Active Data Driver. The Crystal Data Object does not support Memo or Blob fields.

Once the CDO Rowset has been created, it can be used just like any other active data source such as DAO or ADO. Use a procedure, much like the procedure described in Using the Active Data Driver, to print, preview, or export a report at runtime that is based on the CDO data source. Simply replace the steps that explain how to pass a DAO Recordset to the Active Data Driver with appropriate steps for passing your CDO Rowset.

The rest of this section explains how to create a CDO Rowset in Visual Basic. However, as an ActiveX DLL, CDO can be used by any application development environment that supports ActiveX.

To create a CDO Rowset:

 	Obtain a CDO Rowset Object

 	Add Fields to the Rowset Object

 	Obtain Data as Rows

 	Add Rows to the Rowset Object

Use these steps as a guideline for creating your own CDO Rowsets for use with the Active Data Driver.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Obtain a CDO Rowset Object

As stated earlier, CDO is a standard automation server. A Rowset object can be obtained from CDO using the Visual Basic CreateObject function:

Public CDOSet As Object

Set CDOSet = CreateObject("CrystalDataObject.CrystalComObject")

This Rowset object is, essentially, equivalent to a Recordset object you might obtain from DAO or another active data source. It is the Rowset object that you eventually pass to the Active Data Driver.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Fields to the Rowset Object

Once you have a Rowset object, you need to define fields for the Rowset. These fields act as the virtual database fields. The field names you specify must match the field names specified in the data definition file. For more information on data definition files, see Creating Data Definition Files.

Fields are added to a CDO Rowset using the AddField method:

CDOSet.AddField "Order ID", vbString

CDOSet.AddField "Company Name", vbString

CDOSet.AddField "Order Date", vbDate

CDOSet.AddField "Order Amount", vbCurrency

This code adds four fields to the Rowset with the specified field names, and field types. The field types are based on constant values for the Variant data type. The constant names used here are from Visual Basic. For information on valid constant values, see the AddField method in the Crystal Data Source Object Models.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Obtain Data as Rows

Data to be added as rows in the Rowset can be collected in a two dimensional array. The first dimension indicates rows, while the second dimension specifies fields for each row. The number of possible fields indicated by the second dimension must not exceed the number of fields you added to the Rowset using the AddField method. For example, you might define an array such as this:

Dim Rows(11, 3) As Variant

This specifies an array named Rows that contains 12 rows (0 to 11) and 4 columns (0 to 3). Notice that the four fields are defined with the AddField method, so the 4 columns in the Rows array are also defined. In addition, room has been made for 12 rows or records. Finally, since each field holds a different type of data, the array is defined as a Variant type.

Note: If your Rowset contains only a single field, you can use a one dimensional array instead of two dimensional. The single dimension indicates the number of columns or fields in your Rowset.

Now that you have defined an array to hold data, you can begin adding values to the array. These array values will become the actual field values for the virtual database. Most likely, you will want to design a routine in your application that adds runtime data generated by your application into each cell of the array. The following code, however, demonstrates how you can explicitly add values to the array:

Rows(0, 0) = "1002"  ’The first Order ID

Rows(0, 1) = "Cyclist's Trail Co."  ’The first Company Name

Rows(0, 2) = #12/2/94#  ’The first Order Date

Rows(0, 3) = 5060.2725  ’The first Order Amount

From here, you could continue by adding a value to the first field of the second record, Rows (1, 0). You continue filling in data record by record and field by field. This technique, of course, requires a lot of code and is not very practical. Most real applications would contain a looping procedure that progressively filled in values for the array.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Add Rows to the Rowset Object

At this point, you have created a CDO Rowset object, added fields to the Rowset, and collected data in an array that will become part of a virtual runtime database. All that is left is to pass the data from the array to the Rowset object. This step is handled with a single method:

CDOSet.AddRows Rows

The AddRows method accepts a two-dimensional array containing the values you want added to the Rowset and, ultimately, added to a report file that is printed or exported. A one-dimensional array is used to add a single row with multiple fields.

Rows can be added to a CDO Rowset with multiple calls to the AddRows method. However, once you begin adding rows of data to a Rowset, you cannot add any new fields to the Rowset. Any call to AddFields after a successful call to AddRows will fail.

Once you finish populating your virtual database in the CDO Rowset object, you can pass this object as an active data source to the Active Data Driver using the SetDataSource method in the Report Designer Component Automation Server.For complete instructions on doing this, see Pass the Recordset to the Active Data Driver.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Object Model

Crystal Data Objects support several methods and properties that can be used to work with the Rowset object. The object model for CDO is completely defined and described in the section Crystal Data Source Object Models.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Source Type Library

The Crystal Data Source Type Library, like Crystal Data Objects, provides a means for designing customized data sources that can be reported off of using the Active Data Driver. Crystal Data Source, however, unlike CDO, is a type library with an interface that can be implemented in a standard Visual Basic class. Once implemented, the Crystal Data Source interface allows your data to be fully manipulated much like a standard Recordset object in ADO or DAO.

Note: The Crystal Data Source type library is designed for Visual Basic 5.0 or later.

If you simply need a quick means for packaging some data in a form that can easily be reported off of, you should consider using Crystal Data Objects. Crystal Data Source, on the other hand, is designed for developers who need more flexibility when working with custom data sources. Keep in mind, though, once you add the Crystal Data Source interface to your class, you must implement all methods and properties exposed by the interface.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Creating a new project and class

The Crystal Data Source interface can be implemented inside almost any type of application. You might want to create and internal data source, for instance, inside the same standard executable application that you are implementing the Report Designer Component or another of the Crystal Report development tools. See the "Visual Basic Solutions" chapter in the Technical Reference Guide (techrRef.pdf), or the Crystal Reports Developer Guide (CrystalDevHelp.chm) for more information on the other Crystal Reports development tools. On the other hand, you could create an ActiveX DLL that did nothing except implement Crystal Data Source. Your ActiveX DLL then could work as a separate data source to be accessed from other applications, much like ADO, RDO, and DAO are used.

The following topics are discussed in this section:

 	When to use the Crystal Data Source Type Library

 	Creating a new project

 	Adding a class module to a project

 	Adding a Sub Main() procedure

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


When to use the Crystal Data Source Type Library

The Crystal Data Source interface, as stated before, is designed to allow developers to create full-fledged data sources that work much like the ADO Recordset object. In fact, the interface has been designed to support properties and methods with names identical to several corresponding properties and methods in the ADO Recordset object. Through your existing knowledge of ADO, you can quickly familiarize yourself with the Crystal Data Source interface.

If you are designing an application or component that must produce a fully featured data source with methods and properties for easily navigating through records and fields, Crystal Data Source is the ideal solution. Not only is the interface easy to learn and use, it also follows a Recordset standard currently being developed by Microsoft.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Creating a new project

For this tutorial, you will implement the Crystal Data Source interface in an ActiveX DLL that can be referenced by other applications. One such application may be a standard executable that uses the Active Data Driver with the Report Designer Component to produce reports based on this new ActiveX data source.

1	With Visual Basic running, select New Project from the File menu. The New Project dialog box appears.

2	Select ActiveX DLL from the New Project dialog box, and click OK. Your new ActiveX DLL project is created.

3	Select Class1 in the Project window, and make sure the Properties window is displayed. To display the Properties window, press the F4 key or select Properties Window from the View menu.

Note: If you are not creating an ActiveX DLL, you may not have a class module in your project. See the next section, Adding a class module to a project.

4	Change the value of the (Name) property for Class1 to MyDataSource.

5	Select Project1 in the Project window, and change the value of the (Name) property for Project1 to MyDataSourcePrj.

6	Save the project. Use MyDataSource as the name of the class file and the project file.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding a class module to a project

Since you are creating an ActiveX DLL, your project already contains a class module that we can use to implement the Crystal Data Source interface. However, if you are creating a project that does not automatically include a class module, such as a Standard EXE project, you will need to use the following steps.

 	From the Project menu, select Add Class Module. The Add Class Module dialog box appears.

 	Make sure Class Module is selected, and click Open. The new class module is added to your project, and the code window for the module appears.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding a Sub Main() procedure

Although a Sub Main() procedure is not required by ActiveX DLLs created in Visual Basic 5.0 or later, you may want to create a Sub Main() procedure to handle initialization processes. Developers working in Visual Basic 4.0 are required to add the Main subroutine to an Automation Server DLL project and specify that the project use Sub Main() as the entry point. If you are creating an ActiveX EXE in Visual Basic 4.0 or later, you should add the Sub Main() procedure to allow your code to determine if it is being started as a stand-alone application or as an out-of-process automation server.

The following steps demonstrate how to add a Sub Main() procedure in Visual Basic versions 5.0 and 6.0. If you add this procedure to the MyDataSource project, you can leave the procedure empty.

 	From the Project menu in Visual Basic, select Add Module. The New Module dialog box appears.

 	Leave the default Module type selected, and click Open. A new module, Module1, is added to your project.

 	In the code window for the new module, add the following code:

Sub Main()

End Sub

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding the type library

The Crystal Data Source interface is a standard COM (Component Object Model) interface that is defined in a type library (.TLB) file. To implement the Crystal Data Source interface in your Visual Basic application, you must first add a reference to the type library, implement the interface in your class module with the Implements statement, and, finally, create code for each of the properties and methods defined by the interface.

The following topics are discussed in this section:

 	Adding a reference to the Crystal Data Source Type Library

 	Viewing in the Object Browser

 	Using Implements in the class declaration

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding a reference to the Crystal Data Source Type Library

If this is the first time you are using the Crystal Data Source type library, you may need to tell Visual Basic where the type library is located before you can add a reference.

1	From the Project menu, choose References.

The References dialog box appears.

2	Scroll through the Available References list to locate the CRDataSource 1.0 Type Library. If you find the reference, skip to step 6. Otherwise, continue with the next step.

3	In the References dialog box, click the Browse button to locate the type library file.

The Add Reference dialog box appears.

4	Locate the CRSOURCE.TLB type library file in the same directory that you installed Crystal Reports. If you accepted the default directory when you installed the product, this directory will be C:\Program Files\Seagate Software\Crystal Reports.

5	Select CRSOURCE.TLB, and click Open. CRDataSource 1.0 Type Library will now appear in the Available References list in the References dialog box.

6	Place a check mark in the check box next to CRDataSource 1.0 Type Library if one does not appear already.

7	Click OK to add the reference to your project.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Viewing in the Object Browser

Before continuing with the design of your ActiveX DLL project, it may be helpful to look at the object model provided by the Crystal Data Source interface.

1	From the View menu, select Object Browser. The Object Browser appears.

2	Switch the Object Browser to display just the CRDataSourceLib object library.

Notice that the Crystal Data Source interface contains a single object: CRDataSource. This object is similar to the Recordset object you would see if you added a reference to the Microsoft ActiveX Data Objects Recordset 2.0 Library to your project. This is also the object you would pass to the Active Data Driver (Page 306) when producing a report at runtime.

Take a moment to review the properties and methods provided by the CRDataSource object. Close the Object Browser when finished.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Using Implements in the class declaration

The next step is to add the Crystal Data Source interface to your class module.

1	With the code window for the MyDataSource class module open, add the following code to the General Declarations section of the class.

Implements CRDataSourceLib.CRDataSource

2	Open the drop-down list of objects in the upper left of the code window. You will see a new object has been added to the list: CRDataSource.

3	Select CRDataSource from the list of objects. A new Property Get procedure is added to the class module for the FieldCount property of the CRDataSource object. Remember that in COM interfaces, properties are actually implemented as Get and Let procedures. For more information, refer to your Visual Basic documentation.

4	Open the drop-down list in the upper right of the class module code window. Notice that several procedures appear corresponding to the properties and methods of the Crystal Data Source interface. In fact, the properties and methods you saw in the Object Browser are the same properties and methods listed here in the code window.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Implementing the functions

Once you have added the Crystal Data Source interface to your class module, you must implement all of the properties and methods in the interface to successfully produce a data source that can be compiled into an ActiveX DLL and used with the Active Data Driver. The first step to implementing all of the properties and methods is to add procedures to your class for each of the Crystal Data Source procedures.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding procedures

When you selected the CRDataSource object in the object list in the previous section, you automatically added a procedure to the class for the FieldCount property. This property procedure appears in bold in the list of CRDataSource methods and properties to indicate that it has already been added.

1	With the CRDataSource object selected in the code window, select Bookmark [Property Get] from the drop-down list in the upper right corner of the code window. A Property Get procedure appears in the class for the Bookmark property of CRDataSource.

2	Repeat the process for the Property Let procedure of the Bookmark property. Keep in mind that Property Get procedures allow values to be retrieved from properties while Property Let procedures allow values to be assigned to properties.

3	Continue selecting each of the property and method procedures listed so that a procedure appears in your class for every property and every method defined by the Crystal Data Source interface.

4	Notice that each of the procedures has been defined as Private. For our ActiveX DLL to expose these properties and methods to other applications, we need to change these to Public. Replace each Private statement with Public.

5	Save your project to preserve all changes up to this point.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Implementing procedures

Exactly how you implement each of the properties and methods in the CRDDataSource interface depends upon the purpose and design of your application or component. To give you an idea of how to implement the procedures, though, the following code sample simply uses an ADO Recordset object connected to the Xtreme sample data DataSource. Obviously, this example has little value in a real application; an ADO Recordset can itself be reported on through the Active Data Driver. However, the example does illustrate how the properties and methods in the Crystal Data Source interface work.

Implements CRDataSourceLib.CRDataSource

Dim adoRs As ADOR.Recordset

Private Sub Class_Initialize()

    Set adoRs = New ADOR.Recordset

    adoRs.Open "Customer", "Xtreme sample data", _

        adOpenKeyset, adLockOptimistic, adCmdTable

End Sub

Private Sub Class_Terminate()

    adoRs.Close

    Set adoRs = Nothing

End Sub

Public Property Let CRDataSource_Bookmark(ByVal RHS As Variant)

    adoRs.Bookmark = RHS

End Property

Public Property Get CRDataSource_Bookmark() As Variant

    CRDataSource_Bookmark = adoRs.Bookmark

End Property

Public Property Get CRDataSource_EOF() As Boolean

    CRDataSource_EOF = adoRs.EOF

End Property

Public Property Get CRDataSource_FieldCount() As Integer

    CRDataSource_FieldCount = adoRs.Fields.Count

End Property

Public Property Get CRDataSource_FieldName _

    (ByVal FieldIndex As Integer) As String

    CRDataSource_FieldName = adoRs.Fields(FieldIndex).Name

End Property

Public Property Get CRDataSource_FieldType _

    (ByVal FieldIndex As Integer) As Integer

    CRDataSource_FieldType = adoRs.Fields(FieldIndex).Type

End Property

Public Property Get CRDataSource_FieldValue _

    (ByVal FieldIndex As Integer) As Variant

    CRDataSource_FieldValue = adoRs.Fields(FieldIndex).Value

End Property

Public Sub CRDataSource_MoveFirst()

    adoRs.MoveFirst

End Sub

Public Sub CRDataSource_MoveNext()

    adoRs.MoveNext

End Sub

Private Property Get CRDataSource_RecordCount() As Long

    CRDataSource_RecordCount = adoRs.RecordCount

End Property

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Compiling the ActiveX DLL

Once you have finished implementing all of the properties and methods, you can compile the ActiveX DLL. When compiling ActiveX components, Visual Basic registers the component in the Windows Registry database. The name of the project, MyDataSourcePrj in this case, is used as the name of the component. The name of the class module, MyDataSource for this example, becomes the name of a creatable object. Once compiled, the component can be referenced by another application.

1	Make sure you save the entire project so that all source code is preserved.

2	From the File menu, choose Make MyDataSource.dll. Note that the name of the DLL that will be created is based on the name of your Visual Basic project file (.VBP), not on the project name as specified by the (Name) property.

3	When the Make Project dialog box appears, select the location where the new DLL should reside.

4	Click OK, and the new DLL is created and registered.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Passing the CRDataSource object to the Active Data Driver

Using an object that implements the Crystal Data Source interface is a straightforward process, much like using any ActiveX component in an application. A Reference to the component must first be made, then an instance of the component object must be created in the application, and finally, the properties and methods of the object can be used. In this example, we will use the ActiveX DLL we created to obtain a MyDataSource object that we can pass to the Active Data Driver in a report generated using the Crystal Designer Component.

For this example, we will assume you have created an application in Visual Basic and designed a report using the Crystal Report Designer Component. For more information on the Crystal Report Designer Component, see the Crystal Reports Developer’s Guide.

If you want to create a new report that can use the MyDataSource ActiveX DLL, create the report using three fields corresponding to the Customer ID, Customer Name, and City fields in the Customer table of the Xtreme sample data ODBC data source. To make things simple, you can use ADO to connect directly to those three fields. The purpose of this tutorial is simply to teach the techniques, not, necessarily, to produce a real application.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Adding a reference to MyDataSourcePrj

With your application open in Visual Basic:

1	Choose References from the Project menu. The References dialog box appears.

2	Scroll through the list of Available References to locate the MyDataSourcePrj component.

3	Add a check mark to the check box next to MyDataSourcePrj, and click OK. The component is now available to your application.

4	Open the Object Browser in Visual Basic, and select the MyDataSourcePrj library. Notice that the MyDataSource object is available and that this object contains all of the properties and methods that you implemented in the MyDataSource ActiveX DLL. Additionally, each of these properties and methods corresponds to a property or method in CRDataSource.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Creating an instance of MyDataSource

This section assumes you are already familiar with how to pass a new data source to the Active Data Driver at runtime. If you need more information on using the Active Data Driver, refer to Active Data Driver. The following steps simply illustrate how to assign the myDs object created above to the Active Data Driver so that a report will use it as the source of data at runtime.

To actually use the MyDataSourcePrj component, you must create an instance of the MyDataSource object, then assign that object to the Report object displayed by your application. Assuming you created a report in your application using the Crystal Designer Component and accepted default settings for adding the Crystal Report Viewer/ActiveX to your project:

1	Open the code window for the form containing the CrystalReport Viewer/ActiveX.

2	In the General Declarations section for the form, add the following code:

Dim myDs As New MyDataSourcePrj.MyDataSource

3	In the Form_Load procedure, add the following line before the Report object is assigned to the ReportSource property of the CRViewer1 object:

CRXReport.Database.SetDataSource myDs,3, 1

Note: This example is based on a Visual Basic application created using the Report Designer Component. for more information see Report Designer Component Object Model.

The first line of code creates an instance of the MyDataSource object in your application, much like you might create an instance of an ADO Recordset object. The second line of code added uses the SetDataSource method inside the Crystal Designer Component library to dynamically change the source of data used by your report.

If you designed your report using an ADO, DAO, or RDO data source, or by using a Data Definition file, then your report uses the Active Data Driver to access the report data at runtime. Since the Active Data Driver also supports data sources that expose the Crystal Data Source interface, you can easily assign the MyDataSource object to your report.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Source Projects

Now that you have seen the extensive power of the Crystal Data Source interface implemented inside a Visual Basic class, you can begin to consider the extensive possibilities for its use. Many computer based operations produce continuous streams of data in real-time. In your own work, you may encounter needs for gathering data from process control systems, data acquisition applications, or computer-based instrumentation.

In these kinds of applications, data is usually gathered and stored for later analysis. Systems running in real-time, however, may need real-time monitoring and reporting. With objects that implement the Crystal Data Source interface, you can gather and move through data as it is generated, then produce up to the instant analysis through reports.

Programmer’s building n-tier applications that operate across a network may often find themselves designing business objects and other business rules components. By implementing the Crystal Data Source interface in business object components, you can design reports that produce real-time information about data traveling across the network. Even Microsoft Transaction Server components can implement a fully functional ActiveX data source for reporting. Crystal Data Source takes your applications from runtime to real time.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Source Object Models

Crystal Reports provides support for reporting off data when no true data source exists. In this section you will find detailed information, including properties and methods, on Crystal Data Objects and the Crystal Data Source Type Library.

Click the appropriate link to jump to that section:

 	Crystal Data Source Object Models

 	Crystal Data Objects

 	CrystalComObject

 	Crystal Data Source Type Library

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Source Object Models

Crystal Reports includes two ActiveX based data source models to allow on-the-fly reporting when a true data source does not exist at design time, and the data at runtime does not exist in a relational or OLAP database. The Crystal Data Sources allow you to dynamically produce data at runtime inside your code, then pass the data to an existing report file. Both data source models are designed primarily for Visual Basic programmers, but they can be used within other development environments that support ActiveX components and interfaces.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Objects

Crystal Data Objects allow you to quickly design a set of relational data at runtime using standard Visual Basic arrays. For more information on using Crystal Data Objects in Visual Basic, see Crystal Data Object. To add a reference to the Crystal Data Objects component to your Visual Basic application, select the Crystal Data Object item in the Available References list box of the References dialog box. Crystal Data Objects do not support Memo or Blob fields.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CrystalComObject

The CDO component provides a single object named CrystalComObject. This object works much like a Recordset or Rowset that you might use in ADO, DAO, or RDO. Rather than connecting to an existing database, though, CDO allows you to fill it with data stored in a standard Visual Basic array. Once filled with data, the entire object can be passed to the Grid Controls and the Crystal Report Engine at runtime, producing a dynamic report filled with data only available at runtime.

To create an instance of the CrystalComObject in Visual Basic, use the following code as an example:

Dim cdoRowset As ObjectSet cdoRowset = CreateObject("CrystalComObject.CrystalDataObject")

The following topics are discussed in this section:

 	CrystalComObject Properties

 	CrystalComObject Methods

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CrystalComObject Properties

The CrystalComObject provides a single property:

RowCount

Use this property to obtain the number of rows in the rowset once data has been assigned. This is especially useful if data is added to the Rowset in several steps, each step adding more to the size of the Rowset. This value can be used to find out how many rows have been added.

Example

Dim numRows As Long

numRows = cdoRowset.RowCount

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CrystalComObject Methods

The CrystalComObject uses the following methods. These methods each have a section describing their parameters and returns, followed by an example.

 	AddField

 	AddRows

 	DeleteField

 	GetColCount

 	getEOF

 	GetFieldData

 	GetFieldName

 	GetFieldType

 	MoveFirst

 	MoveNext

 	MoveTo

 	Reset

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddField

Function AddField(FieldName As String, [FieldType]) As Boolean

Use this method to add fields to a rowset before adding data. The rowset must have fields defined before data can be added using the AddRows method.

Parameters

FieldName

A string value specifying the name of the field.

FieldType

An optional value specifying the data type that will be contained in this field. Use Visual Basic VarType constants to specify the data type. If this value is omitted, the vbVariant type will be used.

Returns

A Boolean value indicating whether or not the field was successfully added to the Rowset.

Example

cdoRowset.AddField "Order ID", vbString

cdoRowset.AddField "Company Name", vbString

cdoRowset.AddField "Order Amount", vbCurrency

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


AddRows

Sub AddRows(RowData)

Use this method to assign an array of data to the CDO Rowset.

Parameters

RowData

A standard Visual Basic two-dimensional array. The first dimension specifies the number of rows in the Rowset, while the second dimension specifies the number of fields for each row. A one-dimensional array is used to add a single row with multiple fields. When this array is dimensioned, it must be defined As Variant. For example:

Dim Rows(11, 3) As Variant

This example creates an array that will hold 12 rows with 4 fields. You must assign data to all cells in the array before assigning the array to the Rowset using AddRows.

Example

cdoRowset.AddRows Rows

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


DeleteField

Function DeleteField(FieldName As String) As Boolean

This method removes an existing field from the Rowset. If the field contains any data, that data is lost.

Parameters

FieldName

The name of the field you want to delete from the Rowset.

Returns

A Boolean value indicating whether or not the field was successfully deleted. If the field does not exist, this function will return False.

Example

cdoRowset.DeleteField "Company Name"

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetColCount

Function GetColCount() As Integer

This function returns the number of columns or fields currently in the Rowset.

Returns

An integer value indicating the number of fields in the Rowset.

Example

Dim numFields As Integer

numFields = cdoRowset.GetColCount

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


getEOF

Function getEOF() As Boolean

Use this function to determine if the current row in the Rowset is the last row.

Returns

True if the current row is the last row in the Rowset. False if the current row is anywhere else in the Rowset.

Example

If cdoRowset.getEOF Then

    cdoRowset.MoveFirst

End If

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetFieldData

Function GetFieldData(column As Integer)

This method obtains the current value of a specific column in the Rowset for the currently selected row.

Parameters

column

A number indicating which field (column) of the row you want the current value of. Rowset columns, like array dimensions, are 0 based. The first column is 0, the second is 1, etc.

Returns

A variant value that contains the data for the specified field of the current row.

Example

Dim fieldData As Variant

fieldData = cdoRowset.GetFieldData 0

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetFieldName

Function GetFieldName(column As Integer) As String

Returns the name of the specified field (column). Field names are assigned using AddField.

Parameters

column

A number indicating which field (column) of the Rowset you want the name of. Rowset columns, like array dimensions, are 0 based. The first column is 0, the second is 1, etc.

Returns

A string containing the name of the specified field.

Example

Dim secondField As String

secondField = cdoRowset.GetFieldName 1

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


GetFieldType

Function GetFieldType(Field) As Integer

Use this method to obtain the type of data contained by a field in the Rowset. Data types are assigned to fields using AddField.

Parameter

Field

This parameter indicates which field you are querying for the type of data contained. This field can accept either a numeric value or a string value. If you use a numeric value, it must be a number representing the field (column) of the Rowset you want to find out the data type of. Rowset columns, like array dimensions, are 0 based. The first column is 0, the second is 1, etc. If a string is used, the string must contain the name of the field.

Returns

A Visual Basic VarType constant indicating the type of data contained in the field.

Example

Dim dataType As Integer

dataType = cdoRowset.GetFieldType "Customer Id"

If dataType = vbString Then

    ’Do something with the string

End If

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


MoveFirst

Function MoveFirst() As Boolean

This method moves to the first row (record) in the Rowset.

Returns

A Boolean value indicating whether or not the current row was successfully set to the first row. If the Rowset contains no data, this method will return False.

Example

cdoRowset.MoveFirst

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


MoveNext

Function MoveNext() As Boolean

Moves to the next row (record) in the Rowset. The current record is set to the new row.

Returns

A Boolean value indicating whether or not the current record was successfully set to the next row in the Rowset. This function will return False if the current record before calling the method is the last row of the Rowset.

Example

cdoRowset.MoveNext

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


MoveTo

Function MoveTo(recordNum As Long) As Boolean

Moves the current record to the specified record number in the Rowset.

Parameter

recordNum

A 1-based value indicating to which record in the Rowset you want to move. The first record is 1, the second is 2, etc.

Returns

A Boolean value indicating whether or not the current record was successfully set to the specified record number. This method returns False is the specified record does not exist.

Example

cdoRowset.MoveTo 9

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Reset

Sub Reset()

Resets the Rowset, clearing all fields and data.

Example

cdoRowset.Reset

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Crystal Data Source Type Library

The Crystal Data Source Type Library is a COM interface type library that can be implemented in your own Visual Basic classes. One the interface has been added to a class, you must implement every method and property defined by the interface. This process requires extensive Visual Basic coding, but the result is a complete data source that can be used much like other ActiveX data sources such as ADO or DAO. Additionally, a data source defined using the Crystal Data Source Type Library can be passed to report files at runtime through the Grid Controls and the Crystal Report Engine, allowing dynamic runtime reporting on powerful customized data sources.

Possible uses for data sources defined using the Crystal Data Source Type Library are ActiveX style data sources, similar to ADO, DAO, and RDO, Business Objects and business rules components, Microsoft Transaction Server components, or instrumentation systems that produce dynamic real-time data.

Note that as a type library, the Crystal Data Source Type Library does not actually provide any functionality on its own. You must determine the actual functionality by implementing each of the properties and methods defined in the type library interface. The descriptions given here of the CRDataSource object, its properties, and its methods are intended as a guideline for the type of functionality you should define in your own classes.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDataSource

CRDataSource is a COM interface rather than an actual COM object. By writing code for each of the CRDataSource methods and properties in your own code, your class or COM component implements the CRDataSource interface and, therefore, becomes the actual Crystal Data Source.

To implement CRDataSource in a Visual Basic class, use the following code in the General Declarations section of your class module:

Implements CRDataSourceLib.CRDataSource

Once implemented, CRDataSource will appear as an available object in your class module. You must add code for every property and method of the CRDataSource object to correctly implement the Crystal Data Source interface. For more information, see Crystal Data Source Type Library.

The following topics are discussed in this section:

 	CRDataSource Properties

 	CRDataSource Methods

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDataSource Properties

The Crystal Data Source interface defines the following properties. An example of each property follows the property description.

 	Bookmark

 	EOF

 	FieldCount

 	FieldName

 	FieldType

 	FieldValue

 	RecordCount

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CRDataSource Methods

The Crystal Data Source type library defines the following two methods:

 	MoveFirst

 	MoveNext

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Bookmark

Used to obtain a bookmark (identifier) for a particular record in the Recordset, or to move to the record identified by the bookmark. To simplify the process of navigating to a particular record over and over again, you can save a bookmark for the record in a variable, then quickly return to that record by assigning the value of the variable to the Bookmark property.

Example

Dim aBookmark As Variant

aBookmark = myCRDataSource.CRDataSource_Bookmark

’Move around in the Recordset performing various operations

’To return to the bookmarked record:

myCRDataSource.CRDataSource_Bookmark = aBookmark

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


EOF

Read only.

This property indicates whether or not the current record is the last record in the Recordset. The value of the EOF property is True if the current record is the last record, False otherwise.

Example

If myCRDataSource.CRDataSource_EOF = True Then

    myCRDataSource.CRDataSOurce_MoveFirst

End If

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldCount

Read only.

This property returns the number of fields in the Recordset.

Example

Dim numFields as Integer

numFields = myCRDataSource.CRDataSource_FieldCount

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldName

Read only.

Returns the name of a specific field as indicated by the field index. Field indexes for the Crystal Data Source interface start with 1 for the first field, 2 for the second, etc.

Example

Dim firstField As String

Dim secondField As String

firstField = myCRDataSource.CRDataSource_FieldName 1

secondField = myCRDataSource.CRDataSource_FieldName 2

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldType

Read only.

Obtains a Visual Basic VarType constant indicating the type of data stored in a particular field. Fields are identified using field indexes. Field indexes for the Crystal Data Source interface start with 1 for the first field, 2 for the second, etc.

Example

Dim fieldType As Integer

fieldType = myCRDataSource.CRDataSource_FieldType 1

If fieldType = vbString Then

    ’Do something with the string data in this field

End If

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


FieldValue

Obtains the data actually stored in the field for the current record. Fields are identified using field indexes. Field indexes for the Crystal Data Source interface start with 1 for the first field, 2 for the second, etc.

Example

Dim fieldVal As Variant

fieldVal = myCRDataSource.CRDataSource_FieldValue 2

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


RecordCount

Read only.

This property contains the total number of records in the Crystal Data Source recordset.

Example

Dim numRecords as Long

numRecords = myCRDataSource.CRDataSource_RecordCount

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


MoveFirst

Sub MoveFirst()

Moves to the first record in the Recordset. The first record is set as the current record.

Example

myCRDataSource.CRDataSource_MoveFirst

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


MoveNext

Sub MoveNext()

Moves to the next record in the Recordset and sets that record to the current record. A Visual Basic error occurs if the current record before calling this method is the last record. Use EOF to determine if the current record is the last record in the recordset.

Example

If Not myCRDataSource.CRDataSource_EOF Then

    myCRDataSource.CRDataSource_MoveNext

End If

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


The Crystal Active Data Driver Reference

This section provides information on the functions available in the Active Data Driver (P2smon.dll). These functions simplify the creation of Data Definition Files and allow you to pass a recordset to a report using the Crystal Report Print Engine.

Click the appropriate link to jump to that section:

 	Overview

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Overview

The Crystal Active Data Driver provides functions that can be called from your application to simplify the process of designing field definition files and reports at runtime. In addition, a function is provided that translates a Visual Basic object type, such as a Recordset object, into a string value that can be used with the PEGetNthTableLocation function in the Report Engine API.

Declarations of these functions are provided in both C and Visual Basic syntax. If you are using a language other than C, C++, or Visual Basic, refer to the documentation for your development environment for instructions on how to translate C declare statements.

The following topics are discussed in this section:

 	CreateFieldDefFile

 	CreateReportOnRuntimeDS

 	SetActiveDataSource

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CreateFieldDefFile

Creates a tab-separated text file, known as a field definition file, which represents the structure of the data in a specified Recordset or Rowset object. This field definition file can then be used to design a report file using the Runtime DB option in the Create Report Expert of Crystal Reports. When designing an application that prints, previews, or exports the report, the field definition file can be replaced, at runtime, by the Recordset or Rowset object.

C Syntax

BOOL FAR PASCAL CreateFieldDefFile(LPUNKNOWN FAR *lpUnk,

                    LPCSTR fileName,

                    BOOL bOverWriteExistingFile);

Visual Basic Syntax

Declare Function CreateFieldDefFile Lib “p2smon.dll”(lpUnk As Object, _

    ByVal fileName As String, ByVal bOverWriteExistingFile As Long) _

    As Long

Parameters

Parameter
Description
lpUnk
The active data source used to create the field definition file. In C or C++, this is a pointer to an Iunknown derived COM interface relating to a DAO or ADO Recordset. In Visual Basic, this is a Recordset or Rowset object.
fileName
The path and file name of the field definition file to be created.
bOverWriteExistingFile
If a field definition file already exists with the specified path and file name, this flag indicates whether or not to overwrite that file.
Return Value

Returns 0 (False) if the call failed. Returns 1 (True) if the call succeeded and the field definition file was created.

Remarks

This function creates a field definition file only, and does not create a report file. You must create a report file using Crystal Reports.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


CreateReportOnRuntimeDS

Creates a tab-separated text file, known as a field definition file, which represents the structure of the data in a specified Recordset or Rowset object. Then, the function creates a blank report file based on this field definition file. When designing an application that prints, previews, or exports the report, the field definition file can be replaced by the Recordset or Rowset in the active data source.

C Syntax

BOOL FAR PASCAL CreateReportOnRuntimeDS(LPUNKNOWN FAR *lpUnk,

                        LPCSTR reportFile,

                        LPCSTR fieldDefFile,

                        BOOL bOverWriteFile,

                        BOOL bLaunchDesigner);

Visual Basic Syntax

Declare Function CreateReportOnRuntimeDS Lib "p2smon.dll" ( _

    lpUnk As Object, ByVal reportFile As String, ByVal fieldDefFile _

    As String, ByVal bOverWriteFile As Long, ByVal bLaunchDesigner _

    As Long) As Long

Parameters

Parameter
Description
lpUnk
The active data source used to create the field definition file. In C or C++, this is a pointer to an Unknown derived COM interface relating to a DAO or ADO Recordset. In Visual Basic, this is a Recordset or Rowset object.
reportFile
The path and file name of the report file to be created.
fieldDefFile
The path and file name of the field definition file to be created.
bOverWriteFile
If a field definition file already exists with the specified path and file name, this flag indicates whether or not to overwrite that file.
bLaunchDesigner
If True (1), Crystal Reports is launched with the newly created report file opened. Crystal Reports must be installed on the system.
Return Value

Returns 0 (False) if the call failed. Returns 1 (True) if the call succeeded and the field definition file was created.

Remarks

This function creates a field definition file, then creates a report file based on that field definition file. The function CreateFieldDefFile, is unnecessary when this function is used.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


SetActiveDataSource

The SetActiveDataSource Function is used to provide information about a data source to the Crystal Active Data database driver. For instance, if a report has been designed using the Crystal Active Data Driver this method can be used to provide an active data source for the report, such as a DAO, ADO, or RDO recordset or a CDO rowset. In this case, the object passed to the third parameter of this function replaces, at runtime, the field definition file used to create the report.

Visual Basic Syntax

Declare Function SetActiveDataSource Lib "p2smon.dll" (ByVal printJob as Integer,

                                  ByVal tableNum as Integer,

                                  x as Object) As Long

Parameters

Parameter
Description
printJob
Specifies the print job to which you want to add the active data source.
tableNum
The 0 based number of a table for which you want to pass the active data recordset or rowset.
x
Variant data passed to the database driver such as a DAO, ADO or RDO recordset or a CDO rowset.
Return Value

Returns 0 (False) if the call failed. Returns 1 (True) if the call succeeded the data source was passed.

Remarks

The SetActiveDataSource function is used in conjunction with the Crystal Report Print Engine (Crpe32.dll) in a Visual Basic application.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


International Office Directory

This appendix provides contact information by region. For technical support information, see the Technical Support Guide.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


International Office Directory

The following section lists the contact information for Sales and Product Support at each Seagate Software office, worldwide.

For more information, visit our web site at http://www.seagatesoftware.com.

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


North and South American Offices

Canada and USA - North & South American Head Office

Seagate Software840 Cambie StreetVancouver, BC V6B 4J2Canada

Sales and General Inquiries

Telephone: 604 681 3435

Toll-Free: 1 800 877 2340

Fax: 604 681 2934

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Latin America

Sales and General Inquiries

Telephone: 604 681 3435

Fax: 604 681 2934

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Asia/Pacific Offices

Australia

Seagate Software Pty Ltd.Level 9, 52 Alfred StreetMilsons Point, NSW 2061Australia

Sales and General Inquiries

Telephone: +61 2 9955 4088

Fax: +61 2 9955 7682

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Hong Kong

Seagate Software (HK)Suite 2603, 26th FloorUniversal Trade Center3 Arbuthnot Road, CentralHong Kong

Sales and General Inquiries

Telephone: +852 2575 2576

Fax: +852 2893 2727

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Japan

Seagate Software3F, Bridgestone Bldg2-13-12 Hirakawa-cho,Chiyoda-kuTokyo 102-0093

Sales and General Inquiries

Telephone: +81 3 5226 3601

Fax:+81 3 5226 3606

Email: sales_jp@img.seagatesoftware.com

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Malaysia

Seagate Software (a subsidiary of Seagate Technology)Level 36 Menara Citibank165 Jalan AmpangKuala Lumpur 50450Malaysia

Sales and General Inquiries

Telephone: 603 2169-6307 or 603-2169-6308

Fax: 603-2169-6168

Email : southasia@seagatesoftware.com

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Singapore

Seagate Software14 Science Park Drive#03-02 The MaxwellSingapore Science Park118226 Singapore

Sales and General Inquiries

Telephone: +65 777 0533

Fax: +65 777 8786

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Europe

United Kingdom - EMEA and Northern European Head Office

Seagate SoftwareThe Broadwalk54 The BroadwayEaling, London, W5 5JNUnited Kingdom

Seagate SoftwareSt. Matthews Court4 Civic DriveIpswich, Suffolk, 1P1-2QAUnited Kingdom

Sales and General Inquiries

Telephone: +44 (0) 208 566 2020

Fax: +44 (0) 208 231 0600

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Austria

Seagate SoftwareFrankfurter-Str. 21-25D-65760 EschbornGermany

Sales and General Inquiries

Telephone: +49 (0) 69 9509 6310

Fax: +49 (0) 69 9509 6314

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Belgium

Seagate Software62 bis, Avenue Andre MorizetBoulogne-Billancourt CedexParis, F-92643France

Sales and General Inquiries

Telephone: +33 (0) 155 174 082

Fax: +33 (0) 155 174 086

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


France - SEMEA. Southern Europe and Middle East Head Office

Seagate Software62 bis, Avenue Andre MorizetBoulogne-Billancourt CedexParis, 92643France

Sales and General Inquiries

Telephone: +33 (0) 155 174 082or: +33 (0) 1 41 10 16 00

Fax: +33 (0) 155 174 086or: +33 (0) 1 41 10 16 57

Germany - Central European Head Office

Seagate Software GmbHFrankfurter-Str. 21-25D-65760 EschbornGermany

Sales and General Inquiries

Telephone: +49 (0) 69 95 09 63 10

Fax: +49 (0) 69 95 09 63 14

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Ireland

The Broadwalk54 The BroadwayEaling, LondonW5 5JN England

Sales and General Inquiries

Telephone: +44 (0) 208 566 2020

Fax: +44 (020) 208 231 0600

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Italy

Seagate SoftwareVia Conservatorio 2220122 MilanoItaly

Sales and General Inquiries

Telephone: +39 027 729 310

Fax: +39 02 772 940

Netherlands

Seagate SoftwareHojel City CentreGebouwD, 4e etageGraadt Van Roggenweg 328Postbox 19127

3501 DC UtrechtNetherlands

Sales and General Inquiries

Telephone: +44 (0) 208 566 2020

Fax: +44 (0) 208 231 0600

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Spain

Seagate SoftwarePaseo de la Castellana 93-4a28046, MadridSpain

Sales and General Inquiries

Telephone: +34 91 555 5198

Fax: +34 915 559 957

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Sweden

Seagate SoftwareKanalvagen 10CUpplands Vasby194 61 Sweden

Sales and General Inquiries

Telephone: +46 (0) 858 771 171

Fax: + 46 (0) 858 771 172

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Switzerland

Seagate SoftwareWorld Trade CentrePO Box 112Leutschenbachstrasse 95CH-8050 ZurichSwitzerland

Sales and General Inquiries

Telephone: +41 1 308 3922

Fax: +41 1 308 3500

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage


Africa and Middle East

South Africa

Seagate SoftwareSandown Village Office ParkEast Court1 Gwen Lane cnr Maude StreetSandton 2146South Africa

Postal Address

Seagate SoftwarePO Box 78720Sandton 2146Republic of South Africa

Sales and General Inquiries

Telephone: +27 11 3059700

Fax: +27 11 3059702

Seagate Software IMG Holdings, Inc.  http://www.seagatesoftware.com

Support services  http://support.seagatesoftware.com/homepage